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 {
37 public abstract ElevationGraph getElevationGraph(String tag);
38
52 public abstract ArrayList<String> getGraphTags();
53
68 public abstract Sublocation getSublocationById(int id);
69
84 public abstract Category getCategoryById(int id);
85
98 public abstract int getId();
99
112 public abstract int getVersion();
113
126 public abstract String getName();
127
140 public abstract String getDescript();
141
154 public abstract ArrayList<Category> getCategories();
155
168 public abstract ArrayList<Sublocation> getSublocations();
169
182 public abstract boolean getModified();
183
184 private static final class CppProxy extends Location
185 {
186 private final long nativeRef;
187 private final AtomicBoolean destroyed = new AtomicBoolean(false);
188
189 private CppProxy(long nativeRef)
190 {
191 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
192 this.nativeRef = nativeRef;
193 }
194
195 private native void nativeDestroy(long nativeRef);
196 public void _djinni_private_destroy()
197 {
198 boolean destroyed = this.destroyed.getAndSet(true);
199 if (!destroyed) nativeDestroy(this.nativeRef);
200 }
201 protected void finalize() throws java.lang.Throwable
202 {
203 _djinni_private_destroy();
204 super.finalize();
205 }
206
207 // Location methods
208
209 @Override
210 public ElevationGraph getElevationGraph(String tag)
211 {
212 assert !this.destroyed.get() : "trying to use a destroyed object";
213 return native_getElevationGraph(this.nativeRef, tag);
214 }
215 private native ElevationGraph native_getElevationGraph(long _nativeRef, String tag);
216
217 @Override
218 public ArrayList<String> getGraphTags()
219 {
220 assert !this.destroyed.get() : "trying to use a destroyed object";
221 return native_getGraphTags(this.nativeRef);
222 }
223 private native ArrayList<String> native_getGraphTags(long _nativeRef);
224
225 @Override
226 public Sublocation getSublocationById(int id)
227 {
228 assert !this.destroyed.get() : "trying to use a destroyed object";
229 return native_getSublocationById(this.nativeRef, id);
230 }
231 private native Sublocation native_getSublocationById(long _nativeRef, int id);
232
233 @Override
234 public Category getCategoryById(int id)
235 {
236 assert !this.destroyed.get() : "trying to use a destroyed object";
237 return native_getCategoryById(this.nativeRef, id);
238 }
239 private native Category native_getCategoryById(long _nativeRef, int id);
240
241 @Override
242 public int getId()
243 {
244 assert !this.destroyed.get() : "trying to use a destroyed object";
245 return native_getId(this.nativeRef);
246 }
247 private native int native_getId(long _nativeRef);
248
249 @Override
250 public int getVersion()
251 {
252 assert !this.destroyed.get() : "trying to use a destroyed object";
253 return native_getVersion(this.nativeRef);
254 }
255 private native int native_getVersion(long _nativeRef);
256
257 @Override
258 public String getName()
259 {
260 assert !this.destroyed.get() : "trying to use a destroyed object";
261 return native_getName(this.nativeRef);
262 }
263 private native String native_getName(long _nativeRef);
264
265 @Override
266 public String getDescript()
267 {
268 assert !this.destroyed.get() : "trying to use a destroyed object";
269 return native_getDescript(this.nativeRef);
270 }
271 private native String native_getDescript(long _nativeRef);
272
273 @Override
274 public ArrayList<Category> getCategories()
275 {
276 assert !this.destroyed.get() : "trying to use a destroyed object";
277 return native_getCategories(this.nativeRef);
278 }
279 private native ArrayList<Category> native_getCategories(long _nativeRef);
280
281 @Override
282 public ArrayList<Sublocation> getSublocations()
283 {
284 assert !this.destroyed.get() : "trying to use a destroyed object";
285 return native_getSublocations(this.nativeRef);
286 }
287 private native ArrayList<Sublocation> native_getSublocations(long _nativeRef);
288
289 @Override
290 public boolean getModified()
291 {
292 assert !this.destroyed.get() : "trying to use a destroyed object";
293 return native_getModified(this.nativeRef);
294 }
295 private native boolean native_getModified(long _nativeRef);
296 }
297}