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