[Java] Update auto-generated bindings to 0.0.117
[ldk-java] / src / main / java / org / ldk / structs / ScoreUpdate.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  * `ScoreUpdate` is used to update the scorer's internal state after a payment attempt.
12  */
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class ScoreUpdate extends CommonBase {
15         final bindings.LDKScoreUpdate bindings_instance;
16         ScoreUpdate(Object _dummy, long ptr) { super(ptr); bindings_instance = null; }
17         private ScoreUpdate(bindings.LDKScoreUpdate arg) {
18                 super(bindings.LDKScoreUpdate_new(arg));
19                 this.ptrs_to.add(arg);
20                 this.bindings_instance = arg;
21         }
22         @Override @SuppressWarnings("deprecation")
23         protected void finalize() throws Throwable {
24                 if (ptr != 0) { bindings.ScoreUpdate_free(ptr); } super.finalize();
25         }
26         /**
27          * Destroys the object, freeing associated resources. After this call, any access
28          * to this object may result in a SEGFAULT or worse.
29          *
30          * You should generally NEVER call this method. You should let the garbage collector
31          * do this for you when it finalizes objects. However, it may be useful for types
32          * which represent locks and should be closed immediately to avoid holding locks
33          * until the GC runs.
34          */
35         public void destroy() {
36                 if (ptr != 0) { bindings.ScoreUpdate_free(ptr); }
37                 ptr = 0;
38         }
39         public static interface ScoreUpdateInterface {
40                 /**
41                  * Handles updating channel penalties after failing to route through a channel.
42                  */
43                 void payment_path_failed(Path path, long short_channel_id);
44                 /**
45                  * Handles updating channel penalties after successfully routing along a path.
46                  */
47                 void payment_path_successful(Path path);
48                 /**
49                  * Handles updating channel penalties after a probe over the given path failed.
50                  */
51                 void probe_failed(Path path, long short_channel_id);
52                 /**
53                  * Handles updating channel penalties after a probe over the given path succeeded.
54                  */
55                 void probe_successful(Path path);
56         }
57         private static class LDKScoreUpdateHolder { ScoreUpdate held; }
58         public static ScoreUpdate new_impl(ScoreUpdateInterface arg) {
59                 final LDKScoreUpdateHolder impl_holder = new LDKScoreUpdateHolder();
60                 impl_holder.held = new ScoreUpdate(new bindings.LDKScoreUpdate() {
61                         @Override public void payment_path_failed(long path, long short_channel_id) {
62                                 org.ldk.structs.Path path_hu_conv = null; if (path < 0 || path > 4096) { path_hu_conv = new org.ldk.structs.Path(null, path); }
63                                 arg.payment_path_failed(path_hu_conv, short_channel_id);
64                                 Reference.reachabilityFence(arg);
65                         }
66                         @Override public void payment_path_successful(long path) {
67                                 org.ldk.structs.Path path_hu_conv = null; if (path < 0 || path > 4096) { path_hu_conv = new org.ldk.structs.Path(null, path); }
68                                 arg.payment_path_successful(path_hu_conv);
69                                 Reference.reachabilityFence(arg);
70                         }
71                         @Override public void probe_failed(long path, long short_channel_id) {
72                                 org.ldk.structs.Path path_hu_conv = null; if (path < 0 || path > 4096) { path_hu_conv = new org.ldk.structs.Path(null, path); }
73                                 arg.probe_failed(path_hu_conv, short_channel_id);
74                                 Reference.reachabilityFence(arg);
75                         }
76                         @Override public void probe_successful(long path) {
77                                 org.ldk.structs.Path path_hu_conv = null; if (path < 0 || path > 4096) { path_hu_conv = new org.ldk.structs.Path(null, path); }
78                                 arg.probe_successful(path_hu_conv);
79                                 Reference.reachabilityFence(arg);
80                         }
81                 });
82                 return impl_holder.held;
83         }
84         /**
85          * Handles updating channel penalties after failing to route through a channel.
86          */
87         public void payment_path_failed(org.ldk.structs.Path path, long short_channel_id) {
88                 bindings.ScoreUpdate_payment_path_failed(this.ptr, path == null ? 0 : path.ptr, short_channel_id);
89                 Reference.reachabilityFence(this);
90                 Reference.reachabilityFence(path);
91                 Reference.reachabilityFence(short_channel_id);
92                 if (this != null) { this.ptrs_to.add(path); };
93         }
94
95         /**
96          * Handles updating channel penalties after successfully routing along a path.
97          */
98         public void payment_path_successful(org.ldk.structs.Path path) {
99                 bindings.ScoreUpdate_payment_path_successful(this.ptr, path == null ? 0 : path.ptr);
100                 Reference.reachabilityFence(this);
101                 Reference.reachabilityFence(path);
102                 if (this != null) { this.ptrs_to.add(path); };
103         }
104
105         /**
106          * Handles updating channel penalties after a probe over the given path failed.
107          */
108         public void probe_failed(org.ldk.structs.Path path, long short_channel_id) {
109                 bindings.ScoreUpdate_probe_failed(this.ptr, path == null ? 0 : path.ptr, short_channel_id);
110                 Reference.reachabilityFence(this);
111                 Reference.reachabilityFence(path);
112                 Reference.reachabilityFence(short_channel_id);
113                 if (this != null) { this.ptrs_to.add(path); };
114         }
115
116         /**
117          * Handles updating channel penalties after a probe over the given path succeeded.
118          */
119         public void probe_successful(org.ldk.structs.Path path) {
120                 bindings.ScoreUpdate_probe_successful(this.ptr, path == null ? 0 : path.ptr);
121                 Reference.reachabilityFence(this);
122                 Reference.reachabilityFence(path);
123                 if (this != null) { this.ptrs_to.add(path); };
124         }
125
126 }