Loading...
Searching...
No Matches
GraphVertex.java
Go to the documentation of this file.
1package com.navigine.idl.java;
2
3import java.util.concurrent.atomic.AtomicBoolean;
4
16public abstract class GraphVertex {
20 public abstract int getId();
21
25 public abstract Point getPoint();
26
30 public abstract String getName();
31
35 public abstract boolean getIsExternal();
36
40 public abstract boolean getIsElevation();
41
42 private static final class CppProxy extends GraphVertex
43 {
44 private final long nativeRef;
45 private final AtomicBoolean destroyed = new AtomicBoolean(false);
46
47 private CppProxy(long nativeRef)
48 {
49 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
50 this.nativeRef = nativeRef;
51 }
52
53 private native void nativeDestroy(long nativeRef);
54 public void _djinni_private_destroy()
55 {
56 boolean destroyed = this.destroyed.getAndSet(true);
57 if (!destroyed) nativeDestroy(this.nativeRef);
58 }
59 protected void finalize() throws java.lang.Throwable
60 {
61 _djinni_private_destroy();
62 super.finalize();
63 }
64
65 // GraphVertex methods
66
67 @Override
68 public int getId()
69 {
70 assert !this.destroyed.get() : "trying to use a destroyed object";
71 return native_getId(this.nativeRef);
72 }
73 private native int native_getId(long _nativeRef);
74
75 @Override
76 public Point getPoint()
77 {
78 assert !this.destroyed.get() : "trying to use a destroyed object";
79 return native_getPoint(this.nativeRef);
80 }
81 private native Point native_getPoint(long _nativeRef);
82
83 @Override
84 public String getName()
85 {
86 assert !this.destroyed.get() : "trying to use a destroyed object";
87 return native_getName(this.nativeRef);
88 }
89 private native String native_getName(long _nativeRef);
90
91 @Override
92 public boolean getIsExternal()
93 {
94 assert !this.destroyed.get() : "trying to use a destroyed object";
95 return native_getIsExternal(this.nativeRef);
96 }
97 private native boolean native_getIsExternal(long _nativeRef);
98
99 @Override
100 public boolean getIsElevation()
101 {
102 assert !this.destroyed.get() : "trying to use a destroyed object";
103 return native_getIsElevation(this.nativeRef);
104 }
105 private native boolean native_getIsElevation(long _nativeRef);
106 }
107}