37 private static final class CppProxy
extends GraphEdge
39 private final long nativeRef;
40 private final AtomicBoolean destroyed =
new AtomicBoolean(
false);
42 private CppProxy(
long nativeRef)
44 if (nativeRef == 0)
throw new RuntimeException(
"nativeRef is zero");
45 this.nativeRef = nativeRef;
48 private native
void nativeDestroy(
long nativeRef);
49 public void _djinni_private_destroy()
51 boolean destroyed = this.destroyed.getAndSet(
true);
52 if (!destroyed) nativeDestroy(this.nativeRef);
54 protected void finalize() throws
java.lang.Throwable
56 _djinni_private_destroy();
63 public float getWeight()
65 assert !this.destroyed.get() :
"trying to use a destroyed object";
66 return native_getWeight(this.nativeRef);
68 private native
float native_getWeight(
long _nativeRef);
73 assert !this.destroyed.get() :
"trying to use a destroyed object";
74 return native_getDst(this.nativeRef);
76 private native
int native_getDst(
long _nativeRef);
81 assert !this.destroyed.get() :
"trying to use a destroyed object";
82 return native_getSrc(this.nativeRef);
84 private native
int native_getSrc(
long _nativeRef);
87 public int getWeightCoef()
89 assert !this.destroyed.get() :
"trying to use a destroyed object";
90 return native_getWeightCoef(this.nativeRef);
92 private native
int native_getWeightCoef(
long _nativeRef);