[Java] Update auto-generated Java bindings
[ldk-java] / src / main / java / org / ldk / structs / ReplyChannelRange.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 reply_channel_range message is a reply to a query_channel_range
13  * message. Multiple reply_channel_range messages can be sent in reply
14  * to a single query_channel_range message. The query recipient makes a
15  * best effort to respond based on their local network view which may
16  * not be a perfect view of the network. The short_channel_ids in the
17  * reply are encoded. We only support encoding_type=0 uncompressed
18  * serialization and do not support encoding_type=1 zlib serialization.
19  */
20 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
21 public class ReplyChannelRange extends CommonBase {
22         ReplyChannelRange(Object _dummy, long ptr) { super(ptr); }
23         @Override @SuppressWarnings("deprecation")
24         protected void finalize() throws Throwable {
25                 super.finalize();
26                 if (ptr != 0) { bindings.ReplyChannelRange_free(ptr); }
27         }
28
29         /**
30          * The genesis hash of the blockchain being queried
31          */
32         public byte[] get_chain_hash() {
33                 byte[] ret = bindings.ReplyChannelRange_get_chain_hash(this.ptr);
34                 Reference.reachabilityFence(this);
35                 return ret;
36         }
37
38         /**
39          * The genesis hash of the blockchain being queried
40          */
41         public void set_chain_hash(byte[] val) {
42                 bindings.ReplyChannelRange_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
43                 Reference.reachabilityFence(this);
44                 Reference.reachabilityFence(val);
45         }
46
47         /**
48          * The height of the first block in the range of the reply
49          */
50         public int get_first_blocknum() {
51                 int ret = bindings.ReplyChannelRange_get_first_blocknum(this.ptr);
52                 Reference.reachabilityFence(this);
53                 return ret;
54         }
55
56         /**
57          * The height of the first block in the range of the reply
58          */
59         public void set_first_blocknum(int val) {
60                 bindings.ReplyChannelRange_set_first_blocknum(this.ptr, val);
61                 Reference.reachabilityFence(this);
62                 Reference.reachabilityFence(val);
63         }
64
65         /**
66          * The number of blocks included in the range of the reply
67          */
68         public int get_number_of_blocks() {
69                 int ret = bindings.ReplyChannelRange_get_number_of_blocks(this.ptr);
70                 Reference.reachabilityFence(this);
71                 return ret;
72         }
73
74         /**
75          * The number of blocks included in the range of the reply
76          */
77         public void set_number_of_blocks(int val) {
78                 bindings.ReplyChannelRange_set_number_of_blocks(this.ptr, val);
79                 Reference.reachabilityFence(this);
80                 Reference.reachabilityFence(val);
81         }
82
83         /**
84          * True when this is the final reply for a query
85          */
86         public boolean get_sync_complete() {
87                 boolean ret = bindings.ReplyChannelRange_get_sync_complete(this.ptr);
88                 Reference.reachabilityFence(this);
89                 return ret;
90         }
91
92         /**
93          * True when this is the final reply for a query
94          */
95         public void set_sync_complete(boolean val) {
96                 bindings.ReplyChannelRange_set_sync_complete(this.ptr, val);
97                 Reference.reachabilityFence(this);
98                 Reference.reachabilityFence(val);
99         }
100
101         /**
102          * The short_channel_ids in the channel range
103          * 
104          * Returns a copy of the field.
105          */
106         public long[] get_short_channel_ids() {
107                 long[] ret = bindings.ReplyChannelRange_get_short_channel_ids(this.ptr);
108                 Reference.reachabilityFence(this);
109                 return ret;
110         }
111
112         /**
113          * The short_channel_ids in the channel range
114          */
115         public void set_short_channel_ids(long[] val) {
116                 bindings.ReplyChannelRange_set_short_channel_ids(this.ptr, val);
117                 Reference.reachabilityFence(this);
118                 Reference.reachabilityFence(val);
119         }
120
121         /**
122          * Constructs a new ReplyChannelRange given each field
123          */
124         public static ReplyChannelRange of(byte[] chain_hash_arg, int first_blocknum_arg, int number_of_blocks_arg, boolean sync_complete_arg, long[] short_channel_ids_arg) {
125                 long ret = bindings.ReplyChannelRange_new(InternalUtils.check_arr_len(chain_hash_arg, 32), first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg);
126                 Reference.reachabilityFence(chain_hash_arg);
127                 Reference.reachabilityFence(first_blocknum_arg);
128                 Reference.reachabilityFence(number_of_blocks_arg);
129                 Reference.reachabilityFence(sync_complete_arg);
130                 Reference.reachabilityFence(short_channel_ids_arg);
131                 if (ret >= 0 && ret <= 4096) { return null; }
132                 org.ldk.structs.ReplyChannelRange ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ReplyChannelRange(null, ret); }
133                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
134                 return ret_hu_conv;
135         }
136
137         long clone_ptr() {
138                 long ret = bindings.ReplyChannelRange_clone_ptr(this.ptr);
139                 Reference.reachabilityFence(this);
140                 return ret;
141         }
142
143         /**
144          * Creates a copy of the ReplyChannelRange
145          */
146         public ReplyChannelRange clone() {
147                 long ret = bindings.ReplyChannelRange_clone(this.ptr);
148                 Reference.reachabilityFence(this);
149                 if (ret >= 0 && ret <= 4096) { return null; }
150                 org.ldk.structs.ReplyChannelRange ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ReplyChannelRange(null, ret); }
151                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
152                 return ret_hu_conv;
153         }
154
155         /**
156          * Checks if two ReplyChannelRanges contain equal inner contents.
157          * This ignores pointers and is_owned flags and looks at the values in fields.
158          * Two objects with NULL inner values will be considered "equal" here.
159          */
160         public boolean eq(ReplyChannelRange b) {
161                 boolean ret = bindings.ReplyChannelRange_eq(this.ptr, b == null ? 0 : b.ptr);
162                 Reference.reachabilityFence(this);
163                 Reference.reachabilityFence(b);
164                 if (this != null) { this.ptrs_to.add(b); };
165                 return ret;
166         }
167
168         @Override public boolean equals(Object o) {
169                 if (!(o instanceof ReplyChannelRange)) return false;
170                 return this.eq((ReplyChannelRange)o);
171         }
172         /**
173          * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write
174          */
175         public static Result_ReplyChannelRangeDecodeErrorZ read(byte[] ser) {
176                 long ret = bindings.ReplyChannelRange_read(ser);
177                 Reference.reachabilityFence(ser);
178                 if (ret >= 0 && ret <= 4096) { return null; }
179                 Result_ReplyChannelRangeDecodeErrorZ ret_hu_conv = Result_ReplyChannelRangeDecodeErrorZ.constr_from_ptr(ret);
180                 return ret_hu_conv;
181         }
182
183         /**
184          * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read
185          */
186         public byte[] write() {
187                 byte[] ret = bindings.ReplyChannelRange_write(this.ptr);
188                 Reference.reachabilityFence(this);
189                 return ret;
190         }
191
192 }