[Java] Update auto-generated Java bindings for 0.0.113
[ldk-java] / src / main / java / org / ldk / structs / ScorerAccountingForInFlightHtlcs.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 factors in in-flight HTLC liquidity.
13  * 
14  * Useful for custom [`Router`] implementations to wrap their [`Score`] on-the-fly when calling
15  * [`find_route`].
16  * 
17  * [`Score`]: crate::routing::scoring::Score
18  */
19 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
20 public class ScorerAccountingForInFlightHtlcs extends CommonBase {
21         ScorerAccountingForInFlightHtlcs(Object _dummy, long ptr) { super(ptr); }
22         @Override @SuppressWarnings("deprecation")
23         protected void finalize() throws Throwable {
24                 super.finalize();
25                 if (ptr != 0) { bindings.ScorerAccountingForInFlightHtlcs_free(ptr); }
26         }
27
28         /**
29          * Initialize a new `ScorerAccountingForInFlightHtlcs`.
30          */
31         public static ScorerAccountingForInFlightHtlcs of(org.ldk.structs.Score scorer, org.ldk.structs.InFlightHtlcs inflight_htlcs) {
32                 long ret = bindings.ScorerAccountingForInFlightHtlcs_new(scorer == null ? 0 : scorer.ptr, inflight_htlcs == null ? 0 : inflight_htlcs.ptr);
33                 Reference.reachabilityFence(scorer);
34                 Reference.reachabilityFence(inflight_htlcs);
35                 if (ret >= 0 && ret <= 4096) { return null; }
36                 org.ldk.structs.ScorerAccountingForInFlightHtlcs ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ScorerAccountingForInFlightHtlcs(null, ret); }
37                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
38                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(scorer); };
39                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(inflight_htlcs); };
40                 return ret_hu_conv;
41         }
42
43         /**
44          * Serialize the ScorerAccountingForInFlightHtlcs object into a byte array which can be read by ScorerAccountingForInFlightHtlcs_read
45          */
46         public byte[] write() {
47                 byte[] ret = bindings.ScorerAccountingForInFlightHtlcs_write(this.ptr);
48                 Reference.reachabilityFence(this);
49                 return ret;
50         }
51
52         /**
53          * Constructs a new Score which calls the relevant methods on this_arg.
54          * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is
55          */
56         public Score as_Score() {
57                 long ret = bindings.ScorerAccountingForInFlightHtlcs_as_Score(this.ptr);
58                 Reference.reachabilityFence(this);
59                 if (ret >= 0 && ret <= 4096) { return null; }
60                 Score ret_hu_conv = new Score(null, ret);
61                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
62                 return ret_hu_conv;
63         }
64
65 }