Loading...
Searching...
No Matches
Zone.java
Go to the documentation of this file.
1package com.navigine.idl.java;
2
3import java.util.concurrent.atomic.AtomicBoolean;
4
17public abstract class Zone {
30 public abstract Polygon getPolygon();
31
44 public abstract int getLocationId();
45
58 public abstract int getSublocationId();
59
72 public abstract int getId();
73
86 public abstract String getName();
87
100 public abstract String getColor();
101
114 public abstract String getAlias();
115
116 private static final class CppProxy extends Zone
117 {
118 private final long nativeRef;
119 private final AtomicBoolean destroyed = new AtomicBoolean(false);
120
121 private CppProxy(long nativeRef)
122 {
123 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
124 this.nativeRef = nativeRef;
125 }
126
127 private native void nativeDestroy(long nativeRef);
128 public void _djinni_private_destroy()
129 {
130 boolean destroyed = this.destroyed.getAndSet(true);
131 if (!destroyed) nativeDestroy(this.nativeRef);
132 }
133 protected void finalize() throws java.lang.Throwable
134 {
135 _djinni_private_destroy();
136 super.finalize();
137 }
138
139 // Zone methods
140
141 @Override
142 public Polygon getPolygon()
143 {
144 assert !this.destroyed.get() : "trying to use a destroyed object";
145 return native_getPolygon(this.nativeRef);
146 }
147 private native Polygon native_getPolygon(long _nativeRef);
148
149 @Override
150 public int getLocationId()
151 {
152 assert !this.destroyed.get() : "trying to use a destroyed object";
153 return native_getLocationId(this.nativeRef);
154 }
155 private native int native_getLocationId(long _nativeRef);
156
157 @Override
158 public int getSublocationId()
159 {
160 assert !this.destroyed.get() : "trying to use a destroyed object";
161 return native_getSublocationId(this.nativeRef);
162 }
163 private native int native_getSublocationId(long _nativeRef);
164
165 @Override
166 public int getId()
167 {
168 assert !this.destroyed.get() : "trying to use a destroyed object";
169 return native_getId(this.nativeRef);
170 }
171 private native int native_getId(long _nativeRef);
172
173 @Override
174 public String getName()
175 {
176 assert !this.destroyed.get() : "trying to use a destroyed object";
177 return native_getName(this.nativeRef);
178 }
179 private native String native_getName(long _nativeRef);
180
181 @Override
182 public String getColor()
183 {
184 assert !this.destroyed.get() : "trying to use a destroyed object";
185 return native_getColor(this.nativeRef);
186 }
187 private native String native_getColor(long _nativeRef);
188
189 @Override
190 public String getAlias()
191 {
192 assert !this.destroyed.get() : "trying to use a destroyed object";
193 return native_getAlias(this.nativeRef);
194 }
195 private native String native_getAlias(long _nativeRef);
196 }
197}