[C#] Update test to LDK 0.0.123 and pay a BOLT12 offer
[ldk-java] / src / main / java / org / ldk / structs / DefaultRouter.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  * A [`Router`] implemented using [`find_route`].
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class DefaultRouter extends CommonBase {
16         DefaultRouter(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.DefaultRouter_free(ptr); }
21         }
22
23         /**
24          * Creates a new router.
25          */
26         public static DefaultRouter of(org.ldk.structs.NetworkGraph network_graph, org.ldk.structs.Logger logger, org.ldk.structs.EntropySource entropy_source, org.ldk.structs.LockableScore scorer, org.ldk.structs.ProbabilisticScoringFeeParameters score_params) {
27                 long ret = bindings.DefaultRouter_new(network_graph.ptr, logger.ptr, entropy_source.ptr, scorer.ptr, score_params.ptr);
28                 Reference.reachabilityFence(network_graph);
29                 Reference.reachabilityFence(logger);
30                 Reference.reachabilityFence(entropy_source);
31                 Reference.reachabilityFence(scorer);
32                 Reference.reachabilityFence(score_params);
33                 if (ret >= 0 && ret <= 4096) { return null; }
34                 org.ldk.structs.DefaultRouter ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DefaultRouter(null, ret); }
35                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
36                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(network_graph); };
37                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
38                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(entropy_source); };
39                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(scorer); };
40                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(score_params); };
41                 return ret_hu_conv;
42         }
43
44         /**
45          * Constructs a new Router which calls the relevant methods on this_arg.
46          * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is
47          */
48         public Router as_Router() {
49                 long ret = bindings.DefaultRouter_as_Router(this.ptr);
50                 Reference.reachabilityFence(this);
51                 if (ret >= 0 && ret <= 4096) { return null; }
52                 Router ret_hu_conv = new Router(null, ret);
53                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
54                 return ret_hu_conv;
55         }
56
57         /**
58          * Constructs a new MessageRouter which calls the relevant methods on this_arg.
59          * This copies the `inner` pointer in this_arg and thus the returned MessageRouter must be freed before this_arg is
60          */
61         public MessageRouter as_MessageRouter() {
62                 long ret = bindings.DefaultRouter_as_MessageRouter(this.ptr);
63                 Reference.reachabilityFence(this);
64                 if (ret >= 0 && ret <= 4096) { return null; }
65                 MessageRouter ret_hu_conv = new MessageRouter(null, ret);
66                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
67                 return ret_hu_conv;
68         }
69
70 }