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;
10 public class Result_OutputSweeperDecodeErrorZ extends CommonBase {
11 private Result_OutputSweeperDecodeErrorZ(Object _dummy, long ptr) { super(ptr); }
12 protected void finalize() throws Throwable {
13 if (ptr != 0) { bindings.CResult_OutputSweeperDecodeErrorZ_free(ptr); } super.finalize();
16 protected void force_free() {
17 if (ptr != 0) { bindings.CResult_OutputSweeperDecodeErrorZ_free(ptr); ptr = 0; }
20 static Result_OutputSweeperDecodeErrorZ constr_from_ptr(long ptr) {
21 if (bindings.CResult_OutputSweeperDecodeErrorZ_is_ok(ptr)) {
22 return new Result_OutputSweeperDecodeErrorZ_OK(null, ptr);
24 return new Result_OutputSweeperDecodeErrorZ_Err(null, ptr);
27 public static final class Result_OutputSweeperDecodeErrorZ_OK extends Result_OutputSweeperDecodeErrorZ {
28 public final OutputSweeper res;
29 private Result_OutputSweeperDecodeErrorZ_OK(Object _dummy, long ptr) {
31 long res = bindings.CResult_OutputSweeperDecodeErrorZ_get_ok(ptr);
32 org.ldk.structs.OutputSweeper res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new org.ldk.structs.OutputSweeper(null, res); }
33 if (res_hu_conv != null) { res_hu_conv.ptrs_to.add(this); };
34 this.res = res_hu_conv;
38 public static final class Result_OutputSweeperDecodeErrorZ_Err extends Result_OutputSweeperDecodeErrorZ {
39 public final DecodeError err;
40 private Result_OutputSweeperDecodeErrorZ_Err(Object _dummy, long ptr) {
42 long err = bindings.CResult_OutputSweeperDecodeErrorZ_get_err(ptr);
43 org.ldk.structs.DecodeError err_hu_conv = org.ldk.structs.DecodeError.constr_from_ptr(err);
44 if (err_hu_conv != null) { err_hu_conv.ptrs_to.add(this); };
45 this.err = err_hu_conv;
50 * Creates a new CResult_OutputSweeperDecodeErrorZ in the success state.
52 public static Result_OutputSweeperDecodeErrorZ ok(BestBlock o_best_block, BroadcasterInterface o_broadcaster, FeeEstimator o_fee_estimator, Option_FilterZ o_chain_data_source, OutputSpender o_output_spender, ChangeDestinationSource o_change_destination_source, KVStore o_kv_store, Logger o_logger) {
53 long ret = bindings.CResult_OutputSweeperDecodeErrorZ_ok(bindings.OutputSweeper_new(o_best_block.ptr, o_broadcaster.ptr, o_fee_estimator.ptr, o_chain_data_source.ptr, o_output_spender.ptr, o_change_destination_source.ptr, o_kv_store.ptr, o_logger.ptr));
54 Reference.reachabilityFence(o_best_block);
55 Reference.reachabilityFence(o_broadcaster);
56 Reference.reachabilityFence(o_fee_estimator);
57 Reference.reachabilityFence(o_chain_data_source);
58 Reference.reachabilityFence(o_output_spender);
59 Reference.reachabilityFence(o_change_destination_source);
60 Reference.reachabilityFence(o_kv_store);
61 Reference.reachabilityFence(o_logger);
62 if (ret >= 0 && ret <= 4096) { return null; }
63 Result_OutputSweeperDecodeErrorZ ret_hu_conv = Result_OutputSweeperDecodeErrorZ.constr_from_ptr(ret);
64 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o_best_block); };
65 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o_broadcaster); };
66 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o_fee_estimator); };
67 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o_chain_data_source); };
68 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o_output_spender); };
69 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o_change_destination_source); };
70 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o_kv_store); };
71 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o_logger); };
76 * Creates a new CResult_OutputSweeperDecodeErrorZ in the error state.
78 public static Result_OutputSweeperDecodeErrorZ err(org.ldk.structs.DecodeError e) {
79 long ret = bindings.CResult_OutputSweeperDecodeErrorZ_err(e.ptr);
80 Reference.reachabilityFence(e);
81 if (ret >= 0 && ret <= 4096) { return null; }
82 Result_OutputSweeperDecodeErrorZ ret_hu_conv = Result_OutputSweeperDecodeErrorZ.constr_from_ptr(ret);
83 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); };
88 * Checks if the given object is currently in the success state
90 public boolean is_ok() {
91 boolean ret = bindings.CResult_OutputSweeperDecodeErrorZ_is_ok(this.ptr);
92 Reference.reachabilityFence(this);