Loading...
Searching...
No Matches
ElevationGraph.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
18public abstract class ElevationGraph {
31 public abstract ArrayList<GraphEdge> getEdges();
32
33 private static final class CppProxy extends ElevationGraph
34 {
35 private final long nativeRef;
36 private final AtomicBoolean destroyed = new AtomicBoolean(false);
37
38 private CppProxy(long nativeRef)
39 {
40 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
41 this.nativeRef = nativeRef;
42 }
43
44 private native void nativeDestroy(long nativeRef);
45 public void _djinni_private_destroy()
46 {
47 boolean destroyed = this.destroyed.getAndSet(true);
48 if (!destroyed) nativeDestroy(this.nativeRef);
49 }
50 protected void finalize() throws java.lang.Throwable
51 {
52 _djinni_private_destroy();
53 super.finalize();
54 }
55
56 // ElevationGraph methods
57
58 @Override
59 public ArrayList<GraphEdge> getEdges()
60 {
61 assert !this.destroyed.get() : "trying to use a destroyed object";
62 return native_getEdges(this.nativeRef);
63 }
64 private native ArrayList<GraphEdge> native_getEdges(long _nativeRef);
65 }
66}