3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
8 export default class Route extends CommonBase {
9 constructor(_dummy: object, ptr: number) {
14 protected finalize() {
18 bindings.Route_free(this.ptr);
21 public RouteHop[][] get_paths() {
22 number[][] ret = bindings.Route_get_paths(this.ptr);
23 RouteHop[][] ret_conv_12_arr = new RouteHop[ret.length][];
24 for (int m = 0; m < ret.length; m++) {
25 number[] ret_conv_12 = ret[m];
26 RouteHop[] ret_conv_12_conv_10_arr = new RouteHop[ret_conv_12.length];
27 for (int k = 0; k < ret_conv_12.length; k++) {
28 number ret_conv_12_conv_10 = ret_conv_12[k];
29 const ret_conv_12_conv_10_hu_conv: RouteHop = new RouteHop(null, ret_conv_12_conv_10);
30 ret_conv_12_conv_10_hu_conv.ptrs_to.add(this);
31 ret_conv_12_conv_10_arr[k] = ret_conv_12_conv_10_hu_conv;
33 ret_conv_12_arr[m] = ret_conv_12_conv_10_arr;
35 return ret_conv_12_arr;
38 public void set_paths(RouteHop[][] val) {
39 bindings.Route_set_paths(this.ptr, val != null ? Arrays.stream(val).map(val_conv_12 -> val_conv_12 != null ? Arrays.stream(val_conv_12).map(val_conv_12_conv_10 -> val_conv_12_conv_10 == null ? 0 : val_conv_12_conv_10.ptr & ~1).toArray(number[]::new) : null).toArray(number[][]::new) : null);
42 public static Route constructor_new(RouteHop[][] paths_arg) {
43 number ret = bindings.Route_new(paths_arg != null ? Arrays.stream(paths_arg).map(paths_arg_conv_12 -> paths_arg_conv_12 != null ? Arrays.stream(paths_arg_conv_12).map(paths_arg_conv_12_conv_10 -> paths_arg_conv_12_conv_10 == null ? 0 : paths_arg_conv_12_conv_10.ptr & ~1).toArray(number[]::new) : null).toArray(number[][]::new) : null);
44 const ret_hu_conv: Route = new Route(null, ret);
45 ret_hu_conv.ptrs_to.add(ret_hu_conv);
49 public Route clone() {
50 number ret = bindings.Route_clone(this.ptr);
51 const ret_hu_conv: Route = new Route(null, ret);
52 ret_hu_conv.ptrs_to.add(this);
56 public number hash() {
57 number ret = bindings.Route_hash(this.ptr);
61 public boolean eq(Route b) {
62 boolean ret = bindings.Route_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
67 public number get_total_fees() {
68 number ret = bindings.Route_get_total_fees(this.ptr);
72 public number get_total_amount() {
73 number ret = bindings.Route_get_total_amount(this.ptr);
77 public Uint8Array write() {
78 Uint8Array ret = bindings.Route_write(this.ptr);
82 public static Result_RouteDecodeErrorZ constructor_read(Uint8Array ser) {
83 number ret = bindings.Route_read(ser);
84 Result_RouteDecodeErrorZ ret_hu_conv = Result_RouteDecodeErrorZ.constr_from_ptr(ret);