Loading...
Searching...
No Matches
Zone.java
Go to the documentation of this file.
1package com.navigine.idl.java;
2
3import java.util.concurrent.atomic.AtomicBoolean;
4
17public abstract class Zone {
31 public abstract Polygon getPolygon();
32
46 public abstract int getLocationId();
47
61 public abstract int getSublocationId();
62
76 public abstract int getId();
77
91 public abstract String getName();
92
106 public abstract String getColor();
107
121 public abstract String getAlias();
122
123 private static final class CppProxy extends Zone
124 {
125 private final long nativeRef;
126 private final AtomicBoolean destroyed = new AtomicBoolean(false);
127
128 private CppProxy(long nativeRef)
129 {
130 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
131 this.nativeRef = nativeRef;
132 }
133
134 private native void nativeDestroy(long nativeRef);
135 public void _djinni_private_destroy()
136 {
137 boolean destroyed = this.destroyed.getAndSet(true);
138 if (!destroyed) nativeDestroy(this.nativeRef);
139 }
140 protected void finalize() throws java.lang.Throwable
141 {
142 _djinni_private_destroy();
143 super.finalize();
144 }
145
146 // Zone methods
147
148 @Override
149 public Polygon getPolygon()
150 {
151 assert !this.destroyed.get() : "trying to use a destroyed object";
152 return native_getPolygon(this.nativeRef);
153 }
154 private native Polygon native_getPolygon(long _nativeRef);
155
156 @Override
157 public int getLocationId()
158 {
159 assert !this.destroyed.get() : "trying to use a destroyed object";
160 return native_getLocationId(this.nativeRef);
161 }
162 private native int native_getLocationId(long _nativeRef);
163
164 @Override
165 public int getSublocationId()
166 {
167 assert !this.destroyed.get() : "trying to use a destroyed object";
168 return native_getSublocationId(this.nativeRef);
169 }
170 private native int native_getSublocationId(long _nativeRef);
171
172 @Override
173 public int getId()
174 {
175 assert !this.destroyed.get() : "trying to use a destroyed object";
176 return native_getId(this.nativeRef);
177 }
178 private native int native_getId(long _nativeRef);
179
180 @Override
181 public String getName()
182 {
183 assert !this.destroyed.get() : "trying to use a destroyed object";
184 return native_getName(this.nativeRef);
185 }
186 private native String native_getName(long _nativeRef);
187
188 @Override
189 public String getColor()
190 {
191 assert !this.destroyed.get() : "trying to use a destroyed object";
192 return native_getColor(this.nativeRef);
193 }
194 private native String native_getColor(long _nativeRef);
195
196 @Override
197 public String getAlias()
198 {
199 assert !this.destroyed.get() : "trying to use a destroyed object";
200 return native_getAlias(this.nativeRef);
201 }
202 private native String native_getAlias(long _nativeRef);
203 }
204}