Loading...
Searching...
No Matches
RouteManager.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
17public abstract class RouteManager {
36
53 public abstract ArrayList<RoutePath> makeRoutes(LocationPoint from, ArrayList<LocationPoint> to);
54
70 public abstract void setTarget(LocationPoint target);
71
87 public abstract void addTarget(LocationPoint target);
88
102 public abstract void cancelTarget();
103
117 public abstract void clearTargets();
118
132 public abstract void setGraphTag(String tag);
133
147 public abstract String getGraphTag();
148
162 public abstract ArrayList<String> getGraphTags();
163
180 public abstract void addRouteListener(RouteListener listener);
181
196 public abstract void removeRouteListener(RouteListener listener);
197
198 private static final class CppProxy extends RouteManager
199 {
200 private final long nativeRef;
201 private final AtomicBoolean destroyed = new AtomicBoolean(false);
202
203 private CppProxy(long nativeRef)
204 {
205 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
206 this.nativeRef = nativeRef;
207 }
208
209 private native void nativeDestroy(long nativeRef);
210 public void _djinni_private_destroy()
211 {
212 boolean destroyed = this.destroyed.getAndSet(true);
213 if (!destroyed) nativeDestroy(this.nativeRef);
214 }
215 protected void finalize() throws java.lang.Throwable
216 {
217 _djinni_private_destroy();
218 super.finalize();
219 }
220
221 // RouteManager methods
222
223 @Override
224 public RoutePath makeRoute(LocationPoint from, LocationPoint to)
225 {
226 assert !this.destroyed.get() : "trying to use a destroyed object";
227 return native_makeRoute(this.nativeRef, from, to);
228 }
229 private native RoutePath native_makeRoute(long _nativeRef, LocationPoint from, LocationPoint to);
230
231 @Override
232 public ArrayList<RoutePath> makeRoutes(LocationPoint from, ArrayList<LocationPoint> to)
233 {
234 assert !this.destroyed.get() : "trying to use a destroyed object";
235 return native_makeRoutes(this.nativeRef, from, to);
236 }
237 private native ArrayList<RoutePath> native_makeRoutes(long _nativeRef, LocationPoint from, ArrayList<LocationPoint> to);
238
239 @Override
240 public void setTarget(LocationPoint target)
241 {
242 assert !this.destroyed.get() : "trying to use a destroyed object";
243 native_setTarget(this.nativeRef, target);
244 }
245 private native void native_setTarget(long _nativeRef, LocationPoint target);
246
247 @Override
248 public void addTarget(LocationPoint target)
249 {
250 assert !this.destroyed.get() : "trying to use a destroyed object";
251 native_addTarget(this.nativeRef, target);
252 }
253 private native void native_addTarget(long _nativeRef, LocationPoint target);
254
255 @Override
256 public void cancelTarget()
257 {
258 assert !this.destroyed.get() : "trying to use a destroyed object";
259 native_cancelTarget(this.nativeRef);
260 }
261 private native void native_cancelTarget(long _nativeRef);
262
263 @Override
264 public void clearTargets()
265 {
266 assert !this.destroyed.get() : "trying to use a destroyed object";
267 native_clearTargets(this.nativeRef);
268 }
269 private native void native_clearTargets(long _nativeRef);
270
271 @Override
272 public void setGraphTag(String tag)
273 {
274 assert !this.destroyed.get() : "trying to use a destroyed object";
275 native_setGraphTag(this.nativeRef, tag);
276 }
277 private native void native_setGraphTag(long _nativeRef, String tag);
278
279 @Override
280 public String getGraphTag()
281 {
282 assert !this.destroyed.get() : "trying to use a destroyed object";
283 return native_getGraphTag(this.nativeRef);
284 }
285 private native String native_getGraphTag(long _nativeRef);
286
287 @Override
288 public ArrayList<String> getGraphTags()
289 {
290 assert !this.destroyed.get() : "trying to use a destroyed object";
291 return native_getGraphTags(this.nativeRef);
292 }
293 private native ArrayList<String> native_getGraphTags(long _nativeRef);
294
295 @Override
296 public void addRouteListener(RouteListener listener)
297 {
298 assert !this.destroyed.get() : "trying to use a destroyed object";
299 native_addRouteListener(this.nativeRef, listener);
300 }
301 private native void native_addRouteListener(long _nativeRef, RouteListener listener);
302
303 @Override
304 public void removeRouteListener(RouteListener listener)
305 {
306 assert !this.destroyed.get() : "trying to use a destroyed object";
307 native_removeRouteListener(this.nativeRef, listener);
308 }
309 private native void native_removeRouteListener(long _nativeRef, RouteListener listener);
310 }
311}