Loading...
Searching...
No Matches
RoutePath.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
20public abstract class RoutePath {
32 public abstract RoutePath head(float advance);
33
45 public abstract RoutePath tail(float advance);
46
50 public abstract float getLength();
51
55 public abstract ArrayList<RouteEvent> getEvents();
56
62 public abstract ArrayList<LocationPoint> getPoints();
63
64 private static final class CppProxy extends RoutePath
65 {
66 private final long nativeRef;
67 private final AtomicBoolean destroyed = new AtomicBoolean(false);
68
69 private CppProxy(long nativeRef)
70 {
71 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
72 this.nativeRef = nativeRef;
73 }
74
75 private native void nativeDestroy(long nativeRef);
76 public void _djinni_private_destroy()
77 {
78 boolean destroyed = this.destroyed.getAndSet(true);
79 if (!destroyed) nativeDestroy(this.nativeRef);
80 }
81 protected void finalize() throws java.lang.Throwable
82 {
83 _djinni_private_destroy();
84 super.finalize();
85 }
86
87 // RoutePath methods
88
89 @Override
90 public RoutePath head(float advance)
91 {
92 assert !this.destroyed.get() : "trying to use a destroyed object";
93 return native_head(this.nativeRef, advance);
94 }
95 private native RoutePath native_head(long _nativeRef, float advance);
96
97 @Override
98 public RoutePath tail(float advance)
99 {
100 assert !this.destroyed.get() : "trying to use a destroyed object";
101 return native_tail(this.nativeRef, advance);
102 }
103 private native RoutePath native_tail(long _nativeRef, float advance);
104
105 @Override
106 public float getLength()
107 {
108 assert !this.destroyed.get() : "trying to use a destroyed object";
109 return native_getLength(this.nativeRef);
110 }
111 private native float native_getLength(long _nativeRef);
112
113 @Override
114 public ArrayList<RouteEvent> getEvents()
115 {
116 assert !this.destroyed.get() : "trying to use a destroyed object";
117 return native_getEvents(this.nativeRef);
118 }
119 private native ArrayList<RouteEvent> native_getEvents(long _nativeRef);
120
121 @Override
122 public ArrayList<LocationPoint> getPoints()
123 {
124 assert !this.destroyed.get() : "trying to use a destroyed object";
125 return native_getPoints(this.nativeRef);
126 }
127 private native ArrayList<LocationPoint> native_getPoints(long _nativeRef);
128 }
129}