Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / Result_ScoringParametersDecodeErrorZ.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_ScoringParametersDecodeErrorZ extends CommonBase {
10         private Result_ScoringParametersDecodeErrorZ(Object _dummy, long ptr) { super(ptr); }
11         protected void finalize() throws Throwable {
12                 if (ptr != 0) { bindings.CResult_ScoringParametersDecodeErrorZ_free(ptr); } super.finalize();
13         }
14
15         static Result_ScoringParametersDecodeErrorZ constr_from_ptr(long ptr) {
16                 if (bindings.CResult_ScoringParametersDecodeErrorZ_is_ok(ptr)) {
17                         return new Result_ScoringParametersDecodeErrorZ_OK(null, ptr);
18                 } else {
19                         return new Result_ScoringParametersDecodeErrorZ_Err(null, ptr);
20                 }
21         }
22         public static final class Result_ScoringParametersDecodeErrorZ_OK extends Result_ScoringParametersDecodeErrorZ {
23                 public final ScoringParameters res;
24                 private Result_ScoringParametersDecodeErrorZ_OK(Object _dummy, long ptr) {
25                         super(_dummy, ptr);
26                         long res = bindings.LDKCResult_ScoringParametersDecodeErrorZ_get_ok(ptr);
27                         ScoringParameters res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new ScoringParameters(null, res); }
28                         res_hu_conv.ptrs_to.add(this);
29                         this.res = res_hu_conv;
30                 }
31         }
32
33         public static final class Result_ScoringParametersDecodeErrorZ_Err extends Result_ScoringParametersDecodeErrorZ {
34                 public final DecodeError err;
35                 private Result_ScoringParametersDecodeErrorZ_Err(Object _dummy, long ptr) {
36                         super(_dummy, ptr);
37                         long err = bindings.LDKCResult_ScoringParametersDecodeErrorZ_get_err(ptr);
38                         DecodeError err_hu_conv = null; if (err < 0 || err > 4096) { err_hu_conv = new DecodeError(null, err); }
39                         err_hu_conv.ptrs_to.add(this);
40                         this.err = err_hu_conv;
41                 }
42         }
43
44         /**
45          * Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
46          */
47         public static Result_ScoringParametersDecodeErrorZ ok(long o_base_penalty_msat_arg, long o_failure_penalty_msat_arg, long o_failure_penalty_half_life_arg) {
48                 long ret = bindings.CResult_ScoringParametersDecodeErrorZ_ok(bindings.ScoringParameters_new(o_base_penalty_msat_arg, o_failure_penalty_msat_arg, o_failure_penalty_half_life_arg));
49                 if (ret >= 0 && ret <= 4096) { return null; }
50                 Result_ScoringParametersDecodeErrorZ ret_hu_conv = Result_ScoringParametersDecodeErrorZ.constr_from_ptr(ret);
51                 return ret_hu_conv;
52         }
53
54         /**
55          * Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
56          */
57         public static Result_ScoringParametersDecodeErrorZ err(DecodeError e) {
58                 long ret = bindings.CResult_ScoringParametersDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1);
59                 if (ret >= 0 && ret <= 4096) { return null; }
60                 Result_ScoringParametersDecodeErrorZ ret_hu_conv = Result_ScoringParametersDecodeErrorZ.constr_from_ptr(ret);
61                 return ret_hu_conv;
62         }
63
64         /**
65          * Checks if the given object is currently in the success state
66          */
67         public boolean is_ok() {
68                 boolean ret = bindings.CResult_ScoringParametersDecodeErrorZ_is_ok(this.ptr);
69                 return ret;
70         }
71
72 }