Update java bindings with new generator and new upstream code
[ldk-java] / src / main / java / org / ldk / structs / GossipTimestampFilter.java
index 5d5cc30b5df61dbf8d46cee809db2d5991d02cea..f63dbdd3fa260e1f4f2971f0f60bac49d1908295 100644 (file)
@@ -2,59 +2,104 @@ package org.ldk.structs;
 
 import org.ldk.impl.bindings;
 import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
 
+
+/**
+ * A gossip_timestamp_filter message is used by a node to request
+ * gossip relay for messages in the requested time range when the
+ * gossip_queries feature has been negotiated.
+ */
+@SuppressWarnings("unchecked") // We correctly assign various generic arrays
 public class GossipTimestampFilter extends CommonBase {
        GossipTimestampFilter(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.GossipTimestampFilter_free(ptr); super.finalize();
+               super.finalize();
+               if (ptr != 0) { bindings.GossipTimestampFilter_free(ptr); }
+       }
+
+       /**
+        * The genesis hash of the blockchain for channel and node information
+        */
+       public byte[] get_chain_hash() {
+               byte[] ret = bindings.GossipTimestampFilter_get_chain_hash(this.ptr);
+               return ret;
        }
 
-       public GossipTimestampFilter(GossipTimestampFilter orig) {
-               super(bindings.GossipTimestampFilter_clone(orig == null ? 0 : orig.ptr & ~1));
-               this.ptrs_to.add(orig);
+       /**
+        * The genesis hash of the blockchain for channel and node information
+        */
+       public void set_chain_hash(byte[] val) {
+               bindings.GossipTimestampFilter_set_chain_hash(this.ptr, val);
        }
 
-       public byte[] get_chain_hash(GossipTimestampFilter this_ptr) {
-               byte[] ret = bindings.GossipTimestampFilter_get_chain_hash(this_ptr == null ? 0 : this_ptr.ptr & ~1);
-               this.ptrs_to.add(this_ptr);
+       /**
+        * The starting unix timestamp
+        */
+       public int get_first_timestamp() {
+               int ret = bindings.GossipTimestampFilter_get_first_timestamp(this.ptr);
                return ret;
        }
 
-       public void set_chain_hash(GossipTimestampFilter this_ptr, byte[] val) {
-               bindings.GossipTimestampFilter_set_chain_hash(this_ptr == null ? 0 : this_ptr.ptr & ~1, val);
-               this.ptrs_to.add(this_ptr);
+       /**
+        * The starting unix timestamp
+        */
+       public void set_first_timestamp(int val) {
+               bindings.GossipTimestampFilter_set_first_timestamp(this.ptr, val);
        }
 
-       public int get_first_timestamp(GossipTimestampFilter this_ptr) {
-               int ret = bindings.GossipTimestampFilter_get_first_timestamp(this_ptr == null ? 0 : this_ptr.ptr & ~1);
-               this.ptrs_to.add(this_ptr);
+       /**
+        * The range of information in seconds
+        */
+       public int get_timestamp_range() {
+               int ret = bindings.GossipTimestampFilter_get_timestamp_range(this.ptr);
                return ret;
        }
 
-       public void set_first_timestamp(GossipTimestampFilter this_ptr, int val) {
-               bindings.GossipTimestampFilter_set_first_timestamp(this_ptr == null ? 0 : this_ptr.ptr & ~1, val);
-               this.ptrs_to.add(this_ptr);
+       /**
+        * The range of information in seconds
+        */
+       public void set_timestamp_range(int val) {
+               bindings.GossipTimestampFilter_set_timestamp_range(this.ptr, val);
        }
 
-       public int get_timestamp_range(GossipTimestampFilter this_ptr) {
-               int ret = bindings.GossipTimestampFilter_get_timestamp_range(this_ptr == null ? 0 : this_ptr.ptr & ~1);
-               this.ptrs_to.add(this_ptr);
-               return ret;
+       /**
+        * Constructs a new GossipTimestampFilter given each field
+        */
+       public static GossipTimestampFilter constructor_new(byte[] chain_hash_arg, int first_timestamp_arg, int timestamp_range_arg) {
+               long ret = bindings.GossipTimestampFilter_new(chain_hash_arg, first_timestamp_arg, timestamp_range_arg);
+               GossipTimestampFilter ret_hu_conv = new GossipTimestampFilter(null, ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
        }
 
-       public void set_timestamp_range(GossipTimestampFilter this_ptr, int val) {
-               bindings.GossipTimestampFilter_set_timestamp_range(this_ptr == null ? 0 : this_ptr.ptr & ~1, val);
-               this.ptrs_to.add(this_ptr);
+       /**
+        * Creates a copy of the GossipTimestampFilter
+        */
+       public GossipTimestampFilter clone() {
+               long ret = bindings.GossipTimestampFilter_clone(this.ptr);
+               GossipTimestampFilter ret_hu_conv = new GossipTimestampFilter(null, ret);
+               ret_hu_conv.ptrs_to.add(this);
+               return ret_hu_conv;
        }
 
-       public GossipTimestampFilter(byte[] chain_hash_arg, int first_timestamp_arg, int timestamp_range_arg) {
-               super(bindings.GossipTimestampFilter_new(chain_hash_arg, first_timestamp_arg, timestamp_range_arg));
+       /**
+        * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
+        */
+       public static Result_GossipTimestampFilterDecodeErrorZ constructor_read(byte[] ser) {
+               long ret = bindings.GossipTimestampFilter_read(ser);
+               Result_GossipTimestampFilterDecodeErrorZ ret_hu_conv = Result_GossipTimestampFilterDecodeErrorZ.constr_from_ptr(ret);
+               return ret_hu_conv;
        }
 
-       public GossipTimestampFilter(byte[] ser) {
-               super(bindings.GossipTimestampFilter_read(ser));
+       /**
+        * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
+        */
+       public byte[] write() {
+               byte[] ret = bindings.GossipTimestampFilter_write(this.ptr);
+               return ret;
        }
 
-       // Skipped GossipTimestampFilter_write
 }