Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / RouteHint.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
8
9 /**
10  * Private routing information
11  * 
12  * # Invariants
13  * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
14  */
15 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
16 public class RouteHint extends CommonBase {
17         RouteHint(Object _dummy, long ptr) { super(ptr); }
18         @Override @SuppressWarnings("deprecation")
19         protected void finalize() throws Throwable {
20                 super.finalize();
21                 if (ptr != 0) { bindings.RouteHint_free(ptr); }
22         }
23
24         /**
25          * Checks if two RouteHints contain equal inner contents.
26          * This ignores pointers and is_owned flags and looks at the values in fields.
27          * Two objects with NULL inner values will be considered "equal" here.
28          */
29         public boolean eq(RouteHint b) {
30                 boolean ret = bindings.RouteHint_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
31                 this.ptrs_to.add(b);
32                 return ret;
33         }
34
35         /**
36          * Creates a copy of the RouteHint
37          */
38         public RouteHint clone() {
39                 long ret = bindings.RouteHint_clone(this.ptr);
40                 RouteHint ret_hu_conv = new RouteHint(null, ret);
41                 ret_hu_conv.ptrs_to.add(this);
42                 return ret_hu_conv;
43         }
44
45         /**
46          * Create a new (partial) route from a list of hops
47          */
48         public static Result_RouteHintCreationErrorZ of(RouteHintHop[] hops) {
49                 long ret = bindings.RouteHint_new(Arrays.stream(hops).mapToLong(hops_conv_14 -> hops_conv_14 == null ? 0 : hops_conv_14.ptr & ~1).toArray());
50                 Result_RouteHintCreationErrorZ ret_hu_conv = Result_RouteHintCreationErrorZ.constr_from_ptr(ret);
51                 /* TODO 2 RouteHintHop  */;
52                 return ret_hu_conv;
53         }
54
55         /**
56          * Returrn the underlying vector of hops
57          */
58         public RouteHintHop[] into_inner() {
59                 long[] ret = bindings.RouteHint_into_inner(this.ptr);
60                 RouteHintHop[] ret_conv_14_arr = new RouteHintHop[ret.length];
61                 for (int o = 0; o < ret.length; o++) {
62                         long ret_conv_14 = ret[o];
63                         RouteHintHop ret_conv_14_hu_conv = new RouteHintHop(null, ret_conv_14);
64                         ret_conv_14_hu_conv.ptrs_to.add(this);
65                         ret_conv_14_arr[o] = ret_conv_14_hu_conv;
66                 }
67                 this.ptrs_to.add(this);
68                 return ret_conv_14_arr;
69         }
70
71 }