[C#] Update test to LDK 0.0.123 and pay a BOLT12 offer
[ldk-java] / src / main / java / org / ldk / structs / PrivateRoute.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  * Private routing information
13  * 
14  * # Invariants
15  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
16  */
17 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
18 public class PrivateRoute extends CommonBase {
19         PrivateRoute(Object _dummy, long ptr) { super(ptr); }
20         @Override @SuppressWarnings("deprecation")
21         protected void finalize() throws Throwable {
22                 super.finalize();
23                 if (ptr != 0) { bindings.PrivateRoute_free(ptr); }
24         }
25
26         long clone_ptr() {
27                 long ret = bindings.PrivateRoute_clone_ptr(this.ptr);
28                 Reference.reachabilityFence(this);
29                 return ret;
30         }
31
32         /**
33          * Creates a copy of the PrivateRoute
34          */
35         public PrivateRoute clone() {
36                 long ret = bindings.PrivateRoute_clone(this.ptr);
37                 Reference.reachabilityFence(this);
38                 if (ret >= 0 && ret <= 4096) { return null; }
39                 org.ldk.structs.PrivateRoute ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PrivateRoute(null, ret); }
40                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
41                 return ret_hu_conv;
42         }
43
44         /**
45          * Generates a non-cryptographic 64-bit hash of the PrivateRoute.
46          */
47         public long hash() {
48                 long ret = bindings.PrivateRoute_hash(this.ptr);
49                 Reference.reachabilityFence(this);
50                 return ret;
51         }
52
53         @Override public int hashCode() {
54                 return (int)this.hash();
55         }
56         /**
57          * Checks if two PrivateRoutes contain equal inner contents.
58          * This ignores pointers and is_owned flags and looks at the values in fields.
59          * Two objects with NULL inner values will be considered "equal" here.
60          */
61         public boolean eq(org.ldk.structs.PrivateRoute b) {
62                 boolean ret = bindings.PrivateRoute_eq(this.ptr, b.ptr);
63                 Reference.reachabilityFence(this);
64                 Reference.reachabilityFence(b);
65                 if (this != null) { this.ptrs_to.add(b); };
66                 return ret;
67         }
68
69         @Override public boolean equals(Object o) {
70                 if (!(o instanceof PrivateRoute)) return false;
71                 return this.eq((PrivateRoute)o);
72         }
73         /**
74          * Creates a new (partial) route from a list of hops
75          */
76         public static Result_PrivateRouteCreationErrorZ of(org.ldk.structs.RouteHint hops) {
77                 long ret = bindings.PrivateRoute_new(hops.ptr);
78                 Reference.reachabilityFence(hops);
79                 if (ret >= 0 && ret <= 4096) { return null; }
80                 Result_PrivateRouteCreationErrorZ ret_hu_conv = Result_PrivateRouteCreationErrorZ.constr_from_ptr(ret);
81                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(hops); };
82                 return ret_hu_conv;
83         }
84
85         /**
86          * Returns the underlying list of hops
87          */
88         public RouteHint into_inner() {
89                 long ret = bindings.PrivateRoute_into_inner(this.ptr);
90                 Reference.reachabilityFence(this);
91                 if (ret >= 0 && ret <= 4096) { return null; }
92                 org.ldk.structs.RouteHint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RouteHint(null, ret); }
93                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
94                 if (this != null) { this.ptrs_to.add(this); };
95                 return ret_hu_conv;
96         }
97
98 }