Loading...
Searching...
No Matches
Location.java
Go to the documentation of this file.
1package com.navigine.idl.java;
2
3import java.util.ArrayList;
4import java.util.concurrent.atomic.AtomicBoolean;
5
20public abstract class Location {
38 public abstract ElevationGraph getElevationGraph(String tag);
39
54 public abstract ArrayList<String> getGraphTags();
55
71 public abstract Sublocation getSublocationById(int id);
72
88 public abstract Category getCategoryById(int id);
89
103 public abstract int getId();
104
118 public abstract int getVersion();
119
133 public abstract String getName();
134
148 public abstract String getDescript();
149
163 public abstract ArrayList<Category> getCategories();
164
178 public abstract ArrayList<Sublocation> getSublocations();
179
193 public abstract boolean getModified();
194
195 private static final class CppProxy extends Location
196 {
197 private final long nativeRef;
198 private final AtomicBoolean destroyed = new AtomicBoolean(false);
199
200 private CppProxy(long nativeRef)
201 {
202 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
203 this.nativeRef = nativeRef;
204 }
205
206 private native void nativeDestroy(long nativeRef);
207 public void _djinni_private_destroy()
208 {
209 boolean destroyed = this.destroyed.getAndSet(true);
210 if (!destroyed) nativeDestroy(this.nativeRef);
211 }
212 protected void finalize() throws java.lang.Throwable
213 {
214 _djinni_private_destroy();
215 super.finalize();
216 }
217
218 // Location methods
219
220 @Override
221 public ElevationGraph getElevationGraph(String tag)
222 {
223 assert !this.destroyed.get() : "trying to use a destroyed object";
224 return native_getElevationGraph(this.nativeRef, tag);
225 }
226 private native ElevationGraph native_getElevationGraph(long _nativeRef, String tag);
227
228 @Override
229 public ArrayList<String> getGraphTags()
230 {
231 assert !this.destroyed.get() : "trying to use a destroyed object";
232 return native_getGraphTags(this.nativeRef);
233 }
234 private native ArrayList<String> native_getGraphTags(long _nativeRef);
235
236 @Override
237 public Sublocation getSublocationById(int id)
238 {
239 assert !this.destroyed.get() : "trying to use a destroyed object";
240 return native_getSublocationById(this.nativeRef, id);
241 }
242 private native Sublocation native_getSublocationById(long _nativeRef, int id);
243
244 @Override
245 public Category getCategoryById(int id)
246 {
247 assert !this.destroyed.get() : "trying to use a destroyed object";
248 return native_getCategoryById(this.nativeRef, id);
249 }
250 private native Category native_getCategoryById(long _nativeRef, int id);
251
252 @Override
253 public int getId()
254 {
255 assert !this.destroyed.get() : "trying to use a destroyed object";
256 return native_getId(this.nativeRef);
257 }
258 private native int native_getId(long _nativeRef);
259
260 @Override
261 public int getVersion()
262 {
263 assert !this.destroyed.get() : "trying to use a destroyed object";
264 return native_getVersion(this.nativeRef);
265 }
266 private native int native_getVersion(long _nativeRef);
267
268 @Override
269 public String getName()
270 {
271 assert !this.destroyed.get() : "trying to use a destroyed object";
272 return native_getName(this.nativeRef);
273 }
274 private native String native_getName(long _nativeRef);
275
276 @Override
277 public String getDescript()
278 {
279 assert !this.destroyed.get() : "trying to use a destroyed object";
280 return native_getDescript(this.nativeRef);
281 }
282 private native String native_getDescript(long _nativeRef);
283
284 @Override
285 public ArrayList<Category> getCategories()
286 {
287 assert !this.destroyed.get() : "trying to use a destroyed object";
288 return native_getCategories(this.nativeRef);
289 }
290 private native ArrayList<Category> native_getCategories(long _nativeRef);
291
292 @Override
293 public ArrayList<Sublocation> getSublocations()
294 {
295 assert !this.destroyed.get() : "trying to use a destroyed object";
296 return native_getSublocations(this.nativeRef);
297 }
298 private native ArrayList<Sublocation> native_getSublocations(long _nativeRef);
299
300 @Override
301 public boolean getModified()
302 {
303 assert !this.destroyed.get() : "trying to use a destroyed object";
304 return native_getModified(this.nativeRef);
305 }
306 private native boolean native_getModified(long _nativeRef);
307 }
308}