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 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                 PrivateRoute ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PrivateRoute(null, ret); }
40                 ret_hu_conv.ptrs_to.add(this);
41                 return ret_hu_conv;
42         }
43
44         /**
45          * Checks if two PrivateRoutes contain equal inner contents.
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(PrivateRoute b) {
62                 boolean ret = bindings.PrivateRoute_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
63                 Reference.reachabilityFence(this);
64                 Reference.reachabilityFence(b);
65                 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(RouteHint hops) {
77                 long ret = bindings.PrivateRoute_new(hops == null ? 0 : hops.ptr & ~1);
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                 return ret_hu_conv;
82         }
83
84         /**
85          * Returns the underlying list of hops
86          */
87         public RouteHint into_inner() {
88                 long ret = bindings.PrivateRoute_into_inner(this.ptr);
89                 Reference.reachabilityFence(this);
90                 if (ret >= 0 && ret <= 4096) { return null; }
91                 RouteHint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RouteHint(null, ret); }
92                 ret_hu_conv.ptrs_to.add(this);
93                 ;
94                 return ret_hu_conv;
95         }
96
97 }