X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FRouteHint.java;h=f13f5c14a907a27a4e80f01659cf1ac2e7a949ef;hb=b6cc0960eaee5a5bbc7fde79a56152d6dcd649d8;hp=9c6e0f79f97f40f6b4413488dbb48729804f4e73;hpb=110f2f104ba8fc34caa7e34e04737f36f064b050;p=ldk-java diff --git a/src/main/java/org/ldk/structs/RouteHint.java b/src/main/java/org/ldk/structs/RouteHint.java index 9c6e0f79..f13f5c14 100644 --- a/src/main/java/org/ldk/structs/RouteHint.java +++ b/src/main/java/org/ldk/structs/RouteHint.java @@ -5,73 +5,37 @@ import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; + +/** + * A list of hops along a payment path terminating with a channel to the recipient. + */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class RouteHint extends CommonBase { RouteHint(Object _dummy, long ptr) { super(ptr); } @Override @SuppressWarnings("deprecation") protected void finalize() throws Throwable { super.finalize(); - bindings.RouteHint_free(ptr); - } - - public static RouteHint constructor_clone(RouteHint orig) { - long ret = bindings.RouteHint_clone(orig == null ? 0 : orig.ptr & ~1); - RouteHint ret_hu_conv = new RouteHint(null, ret); - ret_hu_conv.ptrs_to.add(orig); - return ret_hu_conv; - } - - public byte[] get_src_node_id() { - byte[] ret = bindings.RouteHint_get_src_node_id(this.ptr); - return ret; - } - - public void set_src_node_id(byte[] val) { - bindings.RouteHint_set_src_node_id(this.ptr, val); + if (ptr != 0) { bindings.RouteHint_free(ptr); } } - public long get_short_channel_id() { - long ret = bindings.RouteHint_get_short_channel_id(this.ptr); + /** + * Checks if two RouteHints contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. + */ + public boolean eq(RouteHint b) { + boolean ret = bindings.RouteHint_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + this.ptrs_to.add(b); return ret; } - public void set_short_channel_id(long val) { - bindings.RouteHint_set_short_channel_id(this.ptr, val); - } - - public RoutingFees get_fees() { - long ret = bindings.RouteHint_get_fees(this.ptr); - RoutingFees ret_hu_conv = new RoutingFees(null, ret); - return ret_hu_conv; - } - - public void set_fees(RoutingFees val) { - bindings.RouteHint_set_fees(this.ptr, val == null ? 0 : val.ptr & ~1); - this.ptrs_to.add(val); - } - - public short get_cltv_expiry_delta() { - short ret = bindings.RouteHint_get_cltv_expiry_delta(this.ptr); - return ret; - } - - public void set_cltv_expiry_delta(short val) { - bindings.RouteHint_set_cltv_expiry_delta(this.ptr, val); - } - - public long get_htlc_minimum_msat() { - long ret = bindings.RouteHint_get_htlc_minimum_msat(this.ptr); - return ret; - } - - public void set_htlc_minimum_msat(long val) { - bindings.RouteHint_set_htlc_minimum_msat(this.ptr, val); - } - - public static RouteHint constructor_new(byte[] src_node_id_arg, long short_channel_id_arg, RoutingFees fees_arg, short cltv_expiry_delta_arg, long htlc_minimum_msat_arg) { - long ret = bindings.RouteHint_new(src_node_id_arg, short_channel_id_arg, fees_arg == null ? 0 : fees_arg.ptr & ~1, cltv_expiry_delta_arg, htlc_minimum_msat_arg); + /** + * Creates a copy of the RouteHint + */ + public RouteHint clone() { + long ret = bindings.RouteHint_clone(this.ptr); RouteHint ret_hu_conv = new RouteHint(null, ret); - ret_hu_conv.ptrs_to.add(fees_arg); + ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; }