Update auto-updated Java files
[ldk-java] / src / main / java / org / ldk / structs / GossipTimestampFilter.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10
11 /**
12  * A gossip_timestamp_filter message is used by a node to request
13  * gossip relay for messages in the requested time range when the
14  * gossip_queries feature has been negotiated.
15  */
16 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
17 public class GossipTimestampFilter extends CommonBase {
18         GossipTimestampFilter(Object _dummy, long ptr) { super(ptr); }
19         @Override @SuppressWarnings("deprecation")
20         protected void finalize() throws Throwable {
21                 super.finalize();
22                 if (ptr != 0) { bindings.GossipTimestampFilter_free(ptr); }
23         }
24
25         /**
26          * The genesis hash of the blockchain for channel and node information
27          */
28         public byte[] get_chain_hash() {
29                 byte[] ret = bindings.GossipTimestampFilter_get_chain_hash(this.ptr);
30                 Reference.reachabilityFence(this);
31                 return ret;
32         }
33
34         /**
35          * The genesis hash of the blockchain for channel and node information
36          */
37         public void set_chain_hash(byte[] val) {
38                 bindings.GossipTimestampFilter_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
39                 Reference.reachabilityFence(this);
40                 Reference.reachabilityFence(val);
41         }
42
43         /**
44          * The starting unix timestamp
45          */
46         public int get_first_timestamp() {
47                 int ret = bindings.GossipTimestampFilter_get_first_timestamp(this.ptr);
48                 Reference.reachabilityFence(this);
49                 return ret;
50         }
51
52         /**
53          * The starting unix timestamp
54          */
55         public void set_first_timestamp(int val) {
56                 bindings.GossipTimestampFilter_set_first_timestamp(this.ptr, val);
57                 Reference.reachabilityFence(this);
58                 Reference.reachabilityFence(val);
59         }
60
61         /**
62          * The range of information in seconds
63          */
64         public int get_timestamp_range() {
65                 int ret = bindings.GossipTimestampFilter_get_timestamp_range(this.ptr);
66                 Reference.reachabilityFence(this);
67                 return ret;
68         }
69
70         /**
71          * The range of information in seconds
72          */
73         public void set_timestamp_range(int val) {
74                 bindings.GossipTimestampFilter_set_timestamp_range(this.ptr, val);
75                 Reference.reachabilityFence(this);
76                 Reference.reachabilityFence(val);
77         }
78
79         /**
80          * Constructs a new GossipTimestampFilter given each field
81          */
82         public static GossipTimestampFilter of(byte[] chain_hash_arg, int first_timestamp_arg, int timestamp_range_arg) {
83                 long ret = bindings.GossipTimestampFilter_new(InternalUtils.check_arr_len(chain_hash_arg, 32), first_timestamp_arg, timestamp_range_arg);
84                 Reference.reachabilityFence(chain_hash_arg);
85                 Reference.reachabilityFence(first_timestamp_arg);
86                 Reference.reachabilityFence(timestamp_range_arg);
87                 if (ret >= 0 && ret <= 4096) { return null; }
88                 GossipTimestampFilter ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new GossipTimestampFilter(null, ret); }
89                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
90                 return ret_hu_conv;
91         }
92
93         long clone_ptr() {
94                 long ret = bindings.GossipTimestampFilter_clone_ptr(this.ptr);
95                 Reference.reachabilityFence(this);
96                 return ret;
97         }
98
99         /**
100          * Creates a copy of the GossipTimestampFilter
101          */
102         public GossipTimestampFilter clone() {
103                 long ret = bindings.GossipTimestampFilter_clone(this.ptr);
104                 Reference.reachabilityFence(this);
105                 if (ret >= 0 && ret <= 4096) { return null; }
106                 GossipTimestampFilter ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new GossipTimestampFilter(null, ret); }
107                 ret_hu_conv.ptrs_to.add(this);
108                 return ret_hu_conv;
109         }
110
111         /**
112          * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
113          */
114         public byte[] write() {
115                 byte[] ret = bindings.GossipTimestampFilter_write(this.ptr);
116                 Reference.reachabilityFence(this);
117                 return ret;
118         }
119
120         /**
121          * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
122          */
123         public static Result_GossipTimestampFilterDecodeErrorZ read(byte[] ser) {
124                 long ret = bindings.GossipTimestampFilter_read(ser);
125                 Reference.reachabilityFence(ser);
126                 if (ret >= 0 && ret <= 4096) { return null; }
127                 Result_GossipTimestampFilterDecodeErrorZ ret_hu_conv = Result_GossipTimestampFilterDecodeErrorZ.constr_from_ptr(ret);
128                 return ret_hu_conv;
129         }
130
131 }