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