[Java] Update auto-generated Java bindings to LDK 0.0.121
[ldk-java] / src / main / java / org / ldk / structs / TwoTuple_PublicKeyCVec_SocketAddressZZ.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 Tuple
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class TwoTuple_PublicKeyCVec_SocketAddressZZ extends CommonBase {
16         TwoTuple_PublicKeyCVec_SocketAddressZZ(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.C2Tuple_PublicKeyCVec_SocketAddressZZ_free(ptr); }
21         }
22
23         /**
24          * 
25          */
26         public byte[] get_a() {
27                 byte[] ret = bindings.C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(this.ptr);
28                 Reference.reachabilityFence(this);
29                 return ret;
30         }
31
32         /**
33          * 
34          */
35         public SocketAddress[] get_b() {
36                 long[] ret = bindings.C2Tuple_PublicKeyCVec_SocketAddressZZ_get_b(this.ptr);
37                 Reference.reachabilityFence(this);
38                 int ret_conv_15_len = ret.length;
39                 SocketAddress[] ret_conv_15_arr = new SocketAddress[ret_conv_15_len];
40                 for (int p = 0; p < ret_conv_15_len; p++) {
41                         long ret_conv_15 = ret[p];
42                         org.ldk.structs.SocketAddress ret_conv_15_hu_conv = org.ldk.structs.SocketAddress.constr_from_ptr(ret_conv_15);
43                         if (ret_conv_15_hu_conv != null) { ret_conv_15_hu_conv.ptrs_to.add(this); };
44                         ret_conv_15_arr[p] = ret_conv_15_hu_conv;
45                 }
46                 return ret_conv_15_arr;
47         }
48
49         long clone_ptr() {
50                 long ret = bindings.C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(this.ptr);
51                 Reference.reachabilityFence(this);
52                 return ret;
53         }
54
55         /**
56          * Creates a new tuple which has the same data as `orig`
57          * but with all dynamically-allocated buffers duplicated in new buffers.
58          */
59         public TwoTuple_PublicKeyCVec_SocketAddressZZ clone() {
60                 long ret = bindings.C2Tuple_PublicKeyCVec_SocketAddressZZ_clone(this.ptr);
61                 Reference.reachabilityFence(this);
62                 if (ret >= 0 && ret <= 4096) { return null; }
63                 TwoTuple_PublicKeyCVec_SocketAddressZZ ret_hu_conv = new TwoTuple_PublicKeyCVec_SocketAddressZZ(null, ret);
64                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
65                 return ret_hu_conv;
66         }
67
68         /**
69          * Creates a new C2Tuple_PublicKeyCVec_SocketAddressZZ from the contained elements.
70          */
71         public static TwoTuple_PublicKeyCVec_SocketAddressZZ of(byte[] a, SocketAddress[] b) {
72                 long ret = bindings.C2Tuple_PublicKeyCVec_SocketAddressZZ_new(InternalUtils.check_arr_len(a, 33), b != null ? Arrays.stream(b).mapToLong(b_conv_15 -> b_conv_15.ptr).toArray() : null);
73                 Reference.reachabilityFence(a);
74                 Reference.reachabilityFence(b);
75                 if (ret >= 0 && ret <= 4096) { return null; }
76                 TwoTuple_PublicKeyCVec_SocketAddressZZ ret_hu_conv = new TwoTuple_PublicKeyCVec_SocketAddressZZ(null, ret);
77                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
78                 for (SocketAddress b_conv_15: b) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(b_conv_15); }; };
79                 return ret_hu_conv;
80         }
81
82 }