1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
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 {
20 if (ptr != 0) { bindings.C2Tuple_PublicKeyCVec_SocketAddressZZ_free(ptr); }
26 public byte[] get_a() {
27 byte[] ret = bindings.C2Tuple_PublicKeyCVec_SocketAddressZZ_get_a(this.ptr);
28 Reference.reachabilityFence(this);
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;
46 return ret_conv_15_arr;
50 long ret = bindings.C2Tuple_PublicKeyCVec_SocketAddressZZ_clone_ptr(this.ptr);
51 Reference.reachabilityFence(this);
56 * Creates a new tuple which has the same data as `orig`
57 * but with all dynamically-allocated buffers duplicated in new buffers.
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); };
69 * Creates a new C2Tuple_PublicKeyCVec_SocketAddressZZ from the contained elements.
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); }; };