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