[Java] Update auto-generated bindings to 0.0.117
[ldk-java] / src / main / java / org / ldk / structs / FixedPenaltyScorer.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  * [`ScoreLookUp`] implementation that uses a fixed penalty.
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class FixedPenaltyScorer extends CommonBase {
16         FixedPenaltyScorer(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.FixedPenaltyScorer_free(ptr); }
21         }
22
23         long clone_ptr() {
24                 long ret = bindings.FixedPenaltyScorer_clone_ptr(this.ptr);
25                 Reference.reachabilityFence(this);
26                 return ret;
27         }
28
29         /**
30          * Creates a copy of the FixedPenaltyScorer
31          */
32         public FixedPenaltyScorer clone() {
33                 long ret = bindings.FixedPenaltyScorer_clone(this.ptr);
34                 Reference.reachabilityFence(this);
35                 if (ret >= 0 && ret <= 4096) { return null; }
36                 org.ldk.structs.FixedPenaltyScorer ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.FixedPenaltyScorer(null, ret); }
37                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
38                 return ret_hu_conv;
39         }
40
41         /**
42          * Creates a new scorer using `penalty_msat`.
43          */
44         public static FixedPenaltyScorer with_penalty(long penalty_msat) {
45                 long ret = bindings.FixedPenaltyScorer_with_penalty(penalty_msat);
46                 Reference.reachabilityFence(penalty_msat);
47                 if (ret >= 0 && ret <= 4096) { return null; }
48                 org.ldk.structs.FixedPenaltyScorer ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.FixedPenaltyScorer(null, ret); }
49                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
50                 return ret_hu_conv;
51         }
52
53         /**
54          * Constructs a new ScoreLookUp which calls the relevant methods on this_arg.
55          * This copies the `inner` pointer in this_arg and thus the returned ScoreLookUp must be freed before this_arg is
56          */
57         public ScoreLookUp as_ScoreLookUp() {
58                 long ret = bindings.FixedPenaltyScorer_as_ScoreLookUp(this.ptr);
59                 Reference.reachabilityFence(this);
60                 if (ret >= 0 && ret <= 4096) { return null; }
61                 ScoreLookUp ret_hu_conv = new ScoreLookUp(null, ret);
62                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
63                 return ret_hu_conv;
64         }
65
66         /**
67          * Constructs a new ScoreUpdate which calls the relevant methods on this_arg.
68          * This copies the `inner` pointer in this_arg and thus the returned ScoreUpdate must be freed before this_arg is
69          */
70         public ScoreUpdate as_ScoreUpdate() {
71                 long ret = bindings.FixedPenaltyScorer_as_ScoreUpdate(this.ptr);
72                 Reference.reachabilityFence(this);
73                 if (ret >= 0 && ret <= 4096) { return null; }
74                 ScoreUpdate ret_hu_conv = new ScoreUpdate(null, ret);
75                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
76                 return ret_hu_conv;
77         }
78
79         /**
80          * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read
81          */
82         public byte[] write() {
83                 byte[] ret = bindings.FixedPenaltyScorer_write(this.ptr);
84                 Reference.reachabilityFence(this);
85                 return ret;
86         }
87
88         /**
89          * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
90          */
91         public static Result_FixedPenaltyScorerDecodeErrorZ read(byte[] ser, long arg) {
92                 long ret = bindings.FixedPenaltyScorer_read(ser, arg);
93                 Reference.reachabilityFence(ser);
94                 Reference.reachabilityFence(arg);
95                 if (ret >= 0 && ret <= 4096) { return null; }
96                 Result_FixedPenaltyScorerDecodeErrorZ ret_hu_conv = Result_FixedPenaltyScorerDecodeErrorZ.constr_from_ptr(ret);
97                 return ret_hu_conv;
98         }
99
100 }