[Java] Update auto-generated Java bindings to LDK 0.0.121
[ldk-java] / src / main / java / org / ldk / structs / DirectedChannelInfo.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  * A wrapper around [`ChannelInfo`] representing information about the channel as directed from a
13  * source node to a target node.
14  */
15 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
16 public class DirectedChannelInfo extends CommonBase {
17         DirectedChannelInfo(Object _dummy, long ptr) { super(ptr); }
18         @Override @SuppressWarnings("deprecation")
19         protected void finalize() throws Throwable {
20                 super.finalize();
21                 if (ptr != 0) { bindings.DirectedChannelInfo_free(ptr); }
22         }
23
24         long clone_ptr() {
25                 long ret = bindings.DirectedChannelInfo_clone_ptr(this.ptr);
26                 Reference.reachabilityFence(this);
27                 return ret;
28         }
29
30         /**
31          * Creates a copy of the DirectedChannelInfo
32          */
33         public DirectedChannelInfo clone() {
34                 long ret = bindings.DirectedChannelInfo_clone(this.ptr);
35                 Reference.reachabilityFence(this);
36                 if (ret >= 0 && ret <= 4096) { return null; }
37                 org.ldk.structs.DirectedChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DirectedChannelInfo(null, ret); }
38                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
39                 return ret_hu_conv;
40         }
41
42         /**
43          * Returns information for the channel.
44          */
45         public ChannelInfo channel() {
46                 long ret = bindings.DirectedChannelInfo_channel(this.ptr);
47                 Reference.reachabilityFence(this);
48                 if (ret >= 0 && ret <= 4096) { return null; }
49                 org.ldk.structs.ChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelInfo(null, ret); }
50                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
51                 return ret_hu_conv;
52         }
53
54         /**
55          * Returns the [`EffectiveCapacity`] of the channel in the direction.
56          * 
57          * This is either the total capacity from the funding transaction, if known, or the
58          * `htlc_maximum_msat` for the direction as advertised by the gossip network, if known,
59          * otherwise.
60          */
61         public EffectiveCapacity effective_capacity() {
62                 long ret = bindings.DirectedChannelInfo_effective_capacity(this.ptr);
63                 Reference.reachabilityFence(this);
64                 if (ret >= 0 && ret <= 4096) { return null; }
65                 org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret);
66                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
67                 return ret_hu_conv;
68         }
69
70 }