[Java] Update auto-generated Java bindings for 0.0.113
[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                 org.ldk.structs.GossipTimestampFilter ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.GossipTimestampFilter(null, ret); }
89                 if (ret_hu_conv != null) { 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                 org.ldk.structs.GossipTimestampFilter ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.GossipTimestampFilter(null, ret); }
107                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
108                 return ret_hu_conv;
109         }
110
111         /**
112          * Checks if two GossipTimestampFilters contain equal inner contents.
113          * This ignores pointers and is_owned flags and looks at the values in fields.
114          * Two objects with NULL inner values will be considered "equal" here.
115          */
116         public boolean eq(org.ldk.structs.GossipTimestampFilter b) {
117                 boolean ret = bindings.GossipTimestampFilter_eq(this.ptr, b == null ? 0 : b.ptr);
118                 Reference.reachabilityFence(this);
119                 Reference.reachabilityFence(b);
120                 if (this != null) { this.ptrs_to.add(b); };
121                 return ret;
122         }
123
124         @Override public boolean equals(Object o) {
125                 if (!(o instanceof GossipTimestampFilter)) return false;
126                 return this.eq((GossipTimestampFilter)o);
127         }
128         /**
129          * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
130          */
131         public byte[] write() {
132                 byte[] ret = bindings.GossipTimestampFilter_write(this.ptr);
133                 Reference.reachabilityFence(this);
134                 return ret;
135         }
136
137         /**
138          * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
139          */
140         public static Result_GossipTimestampFilterDecodeErrorZ read(byte[] ser) {
141                 long ret = bindings.GossipTimestampFilter_read(ser);
142                 Reference.reachabilityFence(ser);
143                 if (ret >= 0 && ret <= 4096) { return null; }
144                 Result_GossipTimestampFilterDecodeErrorZ ret_hu_conv = Result_GossipTimestampFilterDecodeErrorZ.constr_from_ptr(ret);
145                 return ret_hu_conv;
146         }
147
148 }