[Java] Update auto-generated bindings
[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                 DirectedChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new DirectedChannelInfo(null, ret); }
38                 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                 ChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelInfo(null, ret); }
50                 ret_hu_conv.ptrs_to.add(this);
51                 return ret_hu_conv;
52         }
53
54         /**
55          * Returns information for the direction.
56          * 
57          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
58          */
59         @Nullable
60         public ChannelUpdateInfo direction() {
61                 long ret = bindings.DirectedChannelInfo_direction(this.ptr);
62                 Reference.reachabilityFence(this);
63                 if (ret >= 0 && ret <= 4096) { return null; }
64                 ChannelUpdateInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelUpdateInfo(null, ret); }
65                 ret_hu_conv.ptrs_to.add(this);
66                 return ret_hu_conv;
67         }
68
69         /**
70          * Returns the [`EffectiveCapacity`] of the channel in the direction.
71          * 
72          * This is either the total capacity from the funding transaction, if known, or the
73          * `htlc_maximum_msat` for the direction as advertised by the gossip network, if known,
74          * whichever is smaller.
75          */
76         public EffectiveCapacity effective_capacity() {
77                 long ret = bindings.DirectedChannelInfo_effective_capacity(this.ptr);
78                 Reference.reachabilityFence(this);
79                 if (ret >= 0 && ret <= 4096) { return null; }
80                 org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret);
81                 ret_hu_conv.ptrs_to.add(this);
82                 return ret_hu_conv;
83         }
84
85 }