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 {
29 public abstract int getId();
30
43 public abstract Point getPoint();
44
57 public abstract String getName();
58
71 public abstract boolean getIsExternal();
72
85 public abstract boolean getIsElevation();
86
87 private static final class CppProxy extends GraphVertex
88 {
89 private final long nativeRef;
90 private final AtomicBoolean destroyed = new AtomicBoolean(false);
91
92 private CppProxy(long nativeRef)
93 {
94 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
95 this.nativeRef = nativeRef;
96 }
97
98 private native void nativeDestroy(long nativeRef);
99 public void _djinni_private_destroy()
100 {
101 boolean destroyed = this.destroyed.getAndSet(true);
102 if (!destroyed) nativeDestroy(this.nativeRef);
103 }
104 protected void finalize() throws java.lang.Throwable
105 {
106 _djinni_private_destroy();
107 super.finalize();
108 }
109
110 // GraphVertex methods
111
112 @Override
113 public int getId()
114 {
115 assert !this.destroyed.get() : "trying to use a destroyed object";
116 return native_getId(this.nativeRef);
117 }
118 private native int native_getId(long _nativeRef);
119
120 @Override
121 public Point getPoint()
122 {
123 assert !this.destroyed.get() : "trying to use a destroyed object";
124 return native_getPoint(this.nativeRef);
125 }
126 private native Point native_getPoint(long _nativeRef);
127
128 @Override
129 public String getName()
130 {
131 assert !this.destroyed.get() : "trying to use a destroyed object";
132 return native_getName(this.nativeRef);
133 }
134 private native String native_getName(long _nativeRef);
135
136 @Override
137 public boolean getIsExternal()
138 {
139 assert !this.destroyed.get() : "trying to use a destroyed object";
140 return native_getIsExternal(this.nativeRef);
141 }
142 private native boolean native_getIsExternal(long _nativeRef);
143
144 @Override
145 public boolean getIsElevation()
146 {
147 assert !this.destroyed.get() : "trying to use a destroyed object";
148 return native_getIsElevation(this.nativeRef);
149 }
150 private native boolean native_getIsElevation(long _nativeRef);
151 }
152}