[Java] Update auto-generated bindings to 0.0.117
[ldk-java] / src / main / java / org / ldk / structs / ChannelUsage.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  * Proposed use of a channel passed as a parameter to [`ScoreLookUp::channel_penalty_msat`].
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class ChannelUsage extends CommonBase {
16         ChannelUsage(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.ChannelUsage_free(ptr); }
21         }
22
23         /**
24          * The amount to send through the channel, denominated in millisatoshis.
25          */
26         public long get_amount_msat() {
27                 long ret = bindings.ChannelUsage_get_amount_msat(this.ptr);
28                 Reference.reachabilityFence(this);
29                 return ret;
30         }
31
32         /**
33          * The amount to send through the channel, denominated in millisatoshis.
34          */
35         public void set_amount_msat(long val) {
36                 bindings.ChannelUsage_set_amount_msat(this.ptr, val);
37                 Reference.reachabilityFence(this);
38                 Reference.reachabilityFence(val);
39         }
40
41         /**
42          * Total amount, denominated in millisatoshis, already allocated to send through the channel
43          * as part of a multi-path payment.
44          */
45         public long get_inflight_htlc_msat() {
46                 long ret = bindings.ChannelUsage_get_inflight_htlc_msat(this.ptr);
47                 Reference.reachabilityFence(this);
48                 return ret;
49         }
50
51         /**
52          * Total amount, denominated in millisatoshis, already allocated to send through the channel
53          * as part of a multi-path payment.
54          */
55         public void set_inflight_htlc_msat(long val) {
56                 bindings.ChannelUsage_set_inflight_htlc_msat(this.ptr, val);
57                 Reference.reachabilityFence(this);
58                 Reference.reachabilityFence(val);
59         }
60
61         /**
62          * The effective capacity of the channel.
63          */
64         public EffectiveCapacity get_effective_capacity() {
65                 long ret = bindings.ChannelUsage_get_effective_capacity(this.ptr);
66                 Reference.reachabilityFence(this);
67                 if (ret >= 0 && ret <= 4096) { return null; }
68                 org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret);
69                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
70                 return ret_hu_conv;
71         }
72
73         /**
74          * The effective capacity of the channel.
75          */
76         public void set_effective_capacity(org.ldk.structs.EffectiveCapacity val) {
77                 bindings.ChannelUsage_set_effective_capacity(this.ptr, val.ptr);
78                 Reference.reachabilityFence(this);
79                 Reference.reachabilityFence(val);
80                 if (this != null) { this.ptrs_to.add(val); };
81         }
82
83         /**
84          * Constructs a new ChannelUsage given each field
85          */
86         public static ChannelUsage of(long amount_msat_arg, long inflight_htlc_msat_arg, org.ldk.structs.EffectiveCapacity effective_capacity_arg) {
87                 long ret = bindings.ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg.ptr);
88                 Reference.reachabilityFence(amount_msat_arg);
89                 Reference.reachabilityFence(inflight_htlc_msat_arg);
90                 Reference.reachabilityFence(effective_capacity_arg);
91                 if (ret >= 0 && ret <= 4096) { return null; }
92                 org.ldk.structs.ChannelUsage ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelUsage(null, ret); }
93                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
94                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(effective_capacity_arg); };
95                 return ret_hu_conv;
96         }
97
98         long clone_ptr() {
99                 long ret = bindings.ChannelUsage_clone_ptr(this.ptr);
100                 Reference.reachabilityFence(this);
101                 return ret;
102         }
103
104         /**
105          * Creates a copy of the ChannelUsage
106          */
107         public ChannelUsage clone() {
108                 long ret = bindings.ChannelUsage_clone(this.ptr);
109                 Reference.reachabilityFence(this);
110                 if (ret >= 0 && ret <= 4096) { return null; }
111                 org.ldk.structs.ChannelUsage ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelUsage(null, ret); }
112                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
113                 return ret_hu_conv;
114         }
115
116 }