Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.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 javax.annotation.Nullable;
8
9 public class Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ extends CommonBase {
10         private Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ(Object _dummy, long ptr) { super(ptr); }
11         protected void finalize() throws Throwable {
12                 if (ptr != 0) { bindings.CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(ptr); } super.finalize();
13         }
14
15         static Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ constr_from_ptr(long ptr) {
16                 if (bindings.CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(ptr)) {
17                         return new Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_OK(null, ptr);
18                 } else {
19                         return new Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_Err(null, ptr);
20                 }
21         }
22         public static final class Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_OK extends Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
23                 public final TwoTuple_BlockHashChannelMonitorZ[] res;
24                 private Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_OK(Object _dummy, long ptr) {
25                         super(_dummy, ptr);
26                         long[] res = bindings.LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(ptr);
27                         TwoTuple_BlockHashChannelMonitorZ[] res_conv_35_arr = new TwoTuple_BlockHashChannelMonitorZ[res.length];
28                         for (int j = 0; j < res.length; j++) {
29                                 long res_conv_35 = res[j];
30                                 TwoTuple_BlockHashChannelMonitorZ res_conv_35_hu_conv = new TwoTuple_BlockHashChannelMonitorZ(null, res_conv_35);
31                                 res_conv_35_hu_conv.ptrs_to.add(this);
32                                 res_conv_35_arr[j] = res_conv_35_hu_conv;
33                         }
34                         this.res = res_conv_35_arr;
35                 }
36         }
37
38         public static final class Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_Err extends Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
39                 public final IOError err;
40                 private Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_Err(Object _dummy, long ptr) {
41                         super(_dummy, ptr);
42                         this.err = bindings.LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(ptr);
43                 }
44         }
45
46         /**
47          * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
48          */
49         public static Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ ok(TwoTuple_BlockHashChannelMonitorZ[] o) {
50                 long ret = bindings.CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o != null ? Arrays.stream(o).mapToLong(o_conv_35 -> o_conv_35 != null ? o_conv_35.ptr : 0).toArray() : null);
51                 if (ret >= 0 && ret <= 4096) { return null; }
52                 Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ ret_hu_conv = Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.constr_from_ptr(ret);
53                 return ret_hu_conv;
54         }
55
56         /**
57          * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
58          */
59         public static Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ err(org.ldk.enums.IOError e) {
60                 long ret = bindings.CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e);
61                 if (ret >= 0 && ret <= 4096) { return null; }
62                 Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ ret_hu_conv = Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.constr_from_ptr(ret);
63                 return ret_hu_conv;
64         }
65
66         /**
67          * Checks if the given object is currently in the success state
68          */
69         public boolean is_ok() {
70                 boolean ret = bindings.CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(this.ptr);
71                 return ret;
72         }
73
74         long clone_ptr() {
75                 long ret = bindings.CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(this.ptr);
76                 return ret;
77         }
78
79         /**
80          * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ which has the same data as `orig`
81          * but with all dynamically-allocated buffers duplicated in new buffers.
82          */
83         public Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ clone() {
84                 long ret = bindings.CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(this.ptr);
85                 if (ret >= 0 && ret <= 4096) { return null; }
86                 Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ ret_hu_conv = Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.constr_from_ptr(ret);
87                 return ret_hu_conv;
88         }
89
90 }