58 private static final class CppProxy
extends Building
60 private final long nativeRef;
61 private final AtomicBoolean destroyed =
new AtomicBoolean(
false);
63 private CppProxy(
long nativeRef)
65 if (nativeRef == 0)
throw new RuntimeException(
"nativeRef is zero");
66 this.nativeRef = nativeRef;
69 private native
void nativeDestroy(
long nativeRef);
70 public void _djinni_private_destroy()
72 boolean destroyed = this.destroyed.getAndSet(
true);
73 if (!destroyed) nativeDestroy(this.nativeRef);
75 protected void finalize() throws
java.lang.Throwable
77 _djinni_private_destroy();
84 public ArrayList<Sublocation> getSublocations()
86 assert !this.destroyed.get() :
"trying to use a destroyed object";
87 return native_getSublocations(this.nativeRef);
89 private native ArrayList<Sublocation> native_getSublocations(
long _nativeRef);
92 public int getActiveSublocationId()
94 assert !this.destroyed.get() :
"trying to use a destroyed object";
95 return native_getActiveSublocationId(this.nativeRef);
97 private native
int native_getActiveSublocationId(
long _nativeRef);
100 public void setActiveSublocationId(
int activeSublocationId)
102 assert !this.destroyed.get() :
"trying to use a destroyed object";
103 native_setActiveSublocationId(this.nativeRef, activeSublocationId);
105 private native
void native_setActiveSublocationId(
long _nativeRef,
int activeSublocationId);