Update auto-generated bindings to 0.0.103
[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 javax.annotation.Nullable;
8
9
10 /**
11  * Private routing information
12  * 
13  * # Invariants
14  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
15  */
16 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
17 public class PrivateRoute extends CommonBase {
18         PrivateRoute(Object _dummy, long ptr) { super(ptr); }
19         @Override @SuppressWarnings("deprecation")
20         protected void finalize() throws Throwable {
21                 super.finalize();
22                 if (ptr != 0) { bindings.PrivateRoute_free(ptr); }
23         }
24
25         /**
26          * Creates a copy of the PrivateRoute
27          */
28         public PrivateRoute clone() {
29                 long ret = bindings.PrivateRoute_clone(this.ptr);
30                 if (ret >= 0 && ret <= 4096) { return null; }
31                 PrivateRoute ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PrivateRoute(null, ret); }
32                 ret_hu_conv.ptrs_to.add(this);
33                 return ret_hu_conv;
34         }
35
36         /**
37          * Checks if two PrivateRoutes contain equal inner contents.
38          */
39         public long hash() {
40                 long ret = bindings.PrivateRoute_hash(this.ptr);
41                 return ret;
42         }
43
44         /**
45          * Checks if two PrivateRoutes contain equal inner contents.
46          * This ignores pointers and is_owned flags and looks at the values in fields.
47          * Two objects with NULL inner values will be considered "equal" here.
48          */
49         public boolean eq(PrivateRoute b) {
50                 boolean ret = bindings.PrivateRoute_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
51                 this.ptrs_to.add(b);
52                 return ret;
53         }
54
55         /**
56          * Creates a new (partial) route from a list of hops
57          */
58         public static Result_PrivateRouteCreationErrorZ of(RouteHint hops) {
59                 long ret = bindings.PrivateRoute_new(hops == null ? 0 : hops.ptr & ~1);
60                 if (ret >= 0 && ret <= 4096) { return null; }
61                 Result_PrivateRouteCreationErrorZ ret_hu_conv = Result_PrivateRouteCreationErrorZ.constr_from_ptr(ret);
62                 return ret_hu_conv;
63         }
64
65         /**
66          * Returns the underlying list of hops
67          */
68         public RouteHint into_inner() {
69                 long ret = bindings.PrivateRoute_into_inner(this.ptr);
70                 if (ret >= 0 && ret <= 4096) { return null; }
71                 RouteHint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RouteHint(null, ret); }
72                 ret_hu_conv.ptrs_to.add(this);
73                 ;
74                 return ret_hu_conv;
75         }
76
77 }