Update auto-updated Java files
[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         long clone_ptr() {
26                 long ret = bindings.PrivateRoute_clone_ptr(this.ptr);
27                 return ret;
28         }
29
30         /**
31          * Creates a copy of the PrivateRoute
32          */
33         public PrivateRoute clone() {
34                 long ret = bindings.PrivateRoute_clone(this.ptr);
35                 if (ret >= 0 && ret <= 4096) { return null; }
36                 PrivateRoute ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PrivateRoute(null, ret); }
37                 ret_hu_conv.ptrs_to.add(this);
38                 return ret_hu_conv;
39         }
40
41         /**
42          * Checks if two PrivateRoutes contain equal inner contents.
43          */
44         public long hash() {
45                 long ret = bindings.PrivateRoute_hash(this.ptr);
46                 return ret;
47         }
48
49         @Override public int hashCode() {
50                 return (int)this.hash();
51         }
52         /**
53          * Checks if two PrivateRoutes contain equal inner contents.
54          * This ignores pointers and is_owned flags and looks at the values in fields.
55          * Two objects with NULL inner values will be considered "equal" here.
56          */
57         public boolean eq(PrivateRoute b) {
58                 boolean ret = bindings.PrivateRoute_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
59                 this.ptrs_to.add(b);
60                 return ret;
61         }
62
63         @Override public boolean equals(Object o) {
64                 if (!(o instanceof PrivateRoute)) return false;
65                 return this.eq((PrivateRoute)o);
66         }
67         /**
68          * Creates a new (partial) route from a list of hops
69          */
70         public static Result_PrivateRouteCreationErrorZ of(RouteHint hops) {
71                 long ret = bindings.PrivateRoute_new(hops == null ? 0 : hops.ptr & ~1);
72                 if (ret >= 0 && ret <= 4096) { return null; }
73                 Result_PrivateRouteCreationErrorZ ret_hu_conv = Result_PrivateRouteCreationErrorZ.constr_from_ptr(ret);
74                 return ret_hu_conv;
75         }
76
77         /**
78          * Returns the underlying list of hops
79          */
80         public RouteHint into_inner() {
81                 long ret = bindings.PrivateRoute_into_inner(this.ptr);
82                 if (ret >= 0 && ret <= 4096) { return null; }
83                 RouteHint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RouteHint(null, ret); }
84                 ret_hu_conv.ptrs_to.add(this);
85                 ;
86                 return ret_hu_conv;
87         }
88
89 }