Update auto-updated Java files
[ldk-java] / src / main / java / org / ldk / structs / RoutingFees.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  * Fees for routing via a given channel or a node
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class RoutingFees extends CommonBase {
16         RoutingFees(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.RoutingFees_free(ptr); }
21         }
22
23         /**
24          * Flat routing fee in satoshis
25          */
26         public int get_base_msat() {
27                 int ret = bindings.RoutingFees_get_base_msat(this.ptr);
28                 Reference.reachabilityFence(this);
29                 return ret;
30         }
31
32         /**
33          * Flat routing fee in satoshis
34          */
35         public void set_base_msat(int val) {
36                 bindings.RoutingFees_set_base_msat(this.ptr, val);
37                 Reference.reachabilityFence(this);
38                 Reference.reachabilityFence(val);
39         }
40
41         /**
42          * Liquidity-based routing fee in millionths of a routed amount.
43          * In other words, 10000 is 1%.
44          */
45         public int get_proportional_millionths() {
46                 int ret = bindings.RoutingFees_get_proportional_millionths(this.ptr);
47                 Reference.reachabilityFence(this);
48                 return ret;
49         }
50
51         /**
52          * Liquidity-based routing fee in millionths of a routed amount.
53          * In other words, 10000 is 1%.
54          */
55         public void set_proportional_millionths(int val) {
56                 bindings.RoutingFees_set_proportional_millionths(this.ptr, val);
57                 Reference.reachabilityFence(this);
58                 Reference.reachabilityFence(val);
59         }
60
61         /**
62          * Constructs a new RoutingFees given each field
63          */
64         public static RoutingFees of(int base_msat_arg, int proportional_millionths_arg) {
65                 long ret = bindings.RoutingFees_new(base_msat_arg, proportional_millionths_arg);
66                 Reference.reachabilityFence(base_msat_arg);
67                 Reference.reachabilityFence(proportional_millionths_arg);
68                 if (ret >= 0 && ret <= 4096) { return null; }
69                 RoutingFees ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RoutingFees(null, ret); }
70                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
71                 return ret_hu_conv;
72         }
73
74         /**
75          * Checks if two RoutingFeess contain equal inner contents.
76          * This ignores pointers and is_owned flags and looks at the values in fields.
77          * Two objects with NULL inner values will be considered "equal" here.
78          */
79         public boolean eq(RoutingFees b) {
80                 boolean ret = bindings.RoutingFees_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
81                 Reference.reachabilityFence(this);
82                 Reference.reachabilityFence(b);
83                 this.ptrs_to.add(b);
84                 return ret;
85         }
86
87         @Override public boolean equals(Object o) {
88                 if (!(o instanceof RoutingFees)) return false;
89                 return this.eq((RoutingFees)o);
90         }
91         long clone_ptr() {
92                 long ret = bindings.RoutingFees_clone_ptr(this.ptr);
93                 Reference.reachabilityFence(this);
94                 return ret;
95         }
96
97         /**
98          * Creates a copy of the RoutingFees
99          */
100         public RoutingFees clone() {
101                 long ret = bindings.RoutingFees_clone(this.ptr);
102                 Reference.reachabilityFence(this);
103                 if (ret >= 0 && ret <= 4096) { return null; }
104                 RoutingFees ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RoutingFees(null, ret); }
105                 ret_hu_conv.ptrs_to.add(this);
106                 return ret_hu_conv;
107         }
108
109         /**
110          * Checks if two RoutingFeess contain equal inner contents.
111          */
112         public long hash() {
113                 long ret = bindings.RoutingFees_hash(this.ptr);
114                 Reference.reachabilityFence(this);
115                 return ret;
116         }
117
118         @Override public int hashCode() {
119                 return (int)this.hash();
120         }
121         /**
122          * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
123          */
124         public byte[] write() {
125                 byte[] ret = bindings.RoutingFees_write(this.ptr);
126                 Reference.reachabilityFence(this);
127                 return ret;
128         }
129
130         /**
131          * Read a RoutingFees from a byte array, created by RoutingFees_write
132          */
133         public static Result_RoutingFeesDecodeErrorZ read(byte[] ser) {
134                 long ret = bindings.RoutingFees_read(ser);
135                 Reference.reachabilityFence(ser);
136                 if (ret >= 0 && ret <= 4096) { return null; }
137                 Result_RoutingFeesDecodeErrorZ ret_hu_conv = Result_RoutingFeesDecodeErrorZ.constr_from_ptr(ret);
138                 return ret_hu_conv;
139         }
140
141 }