73 private static final class CppProxy
extends GraphEdge
75 private final long nativeRef;
76 private final AtomicBoolean destroyed =
new AtomicBoolean(
false);
78 private CppProxy(
long nativeRef)
80 if (nativeRef == 0)
throw new RuntimeException(
"nativeRef is zero");
81 this.nativeRef = nativeRef;
84 private native
void nativeDestroy(
long nativeRef);
85 public void _djinni_private_destroy()
87 boolean destroyed = this.destroyed.getAndSet(
true);
88 if (!destroyed) nativeDestroy(this.nativeRef);
90 protected void finalize() throws
java.lang.Throwable
92 _djinni_private_destroy();
99 public float getWeight()
101 assert !this.destroyed.get() :
"trying to use a destroyed object";
102 return native_getWeight(this.nativeRef);
104 private native
float native_getWeight(
long _nativeRef);
109 assert !this.destroyed.get() :
"trying to use a destroyed object";
110 return native_getDst(this.nativeRef);
112 private native
int native_getDst(
long _nativeRef);
117 assert !this.destroyed.get() :
"trying to use a destroyed object";
118 return native_getSrc(this.nativeRef);
120 private native
int native_getSrc(
long _nativeRef);
123 public int getWeightCoef()
125 assert !this.destroyed.get() :
"trying to use a destroyed object";
126 return native_getWeightCoef(this.nativeRef);
128 private native
int native_getWeightCoef(
long _nativeRef);