[Java] Update auto-generated bindings
[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  * [`Score`] 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                 FixedPenaltyScorer ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new FixedPenaltyScorer(null, ret); }
37                 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                 FixedPenaltyScorer ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new FixedPenaltyScorer(null, ret); }
49                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
50                 return ret_hu_conv;
51         }
52
53         /**
54          * Constructs a new Score which calls the relevant methods on this_arg.
55          * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
56          */
57         public Score as_Score() {
58                 long ret = bindings.FixedPenaltyScorer_as_Score(this.ptr);
59                 Reference.reachabilityFence(this);
60                 if (ret >= 0 && ret <= 4096) { return null; }
61                 Score ret_hu_conv = new Score(null, ret);
62                 ret_hu_conv.ptrs_to.add(this);
63                 return ret_hu_conv;
64         }
65
66         /**
67          * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read
68          */
69         public byte[] write() {
70                 byte[] ret = bindings.FixedPenaltyScorer_write(this.ptr);
71                 Reference.reachabilityFence(this);
72                 return ret;
73         }
74
75         /**
76          * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write
77          */
78         public static Result_FixedPenaltyScorerDecodeErrorZ read(byte[] ser, long arg) {
79                 long ret = bindings.FixedPenaltyScorer_read(ser, arg);
80                 Reference.reachabilityFence(ser);
81                 Reference.reachabilityFence(arg);
82                 if (ret >= 0 && ret <= 4096) { return null; }
83                 Result_FixedPenaltyScorerDecodeErrorZ ret_hu_conv = Result_FixedPenaltyScorerDecodeErrorZ.constr_from_ptr(ret);
84                 return ret_hu_conv;
85         }
86
87 }