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 {
40 public abstract RoutePath head(float advance);
41
61 public abstract RoutePath tail(float advance);
62
75 public abstract float getLength();
76
89 public abstract ArrayList<RouteEvent> getEvents();
90
105 public abstract ArrayList<LocationPoint> getPoints();
106
107 private static final class CppProxy extends RoutePath
108 {
109 private final long nativeRef;
110 private final AtomicBoolean destroyed = new AtomicBoolean(false);
111
112 private CppProxy(long nativeRef)
113 {
114 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
115 this.nativeRef = nativeRef;
116 }
117
118 private native void nativeDestroy(long nativeRef);
119 public void _djinni_private_destroy()
120 {
121 boolean destroyed = this.destroyed.getAndSet(true);
122 if (!destroyed) nativeDestroy(this.nativeRef);
123 }
124 protected void finalize() throws java.lang.Throwable
125 {
126 _djinni_private_destroy();
127 super.finalize();
128 }
129
130 // RoutePath methods
131
132 @Override
133 public RoutePath head(float advance)
134 {
135 assert !this.destroyed.get() : "trying to use a destroyed object";
136 return native_head(this.nativeRef, advance);
137 }
138 private native RoutePath native_head(long _nativeRef, float advance);
139
140 @Override
141 public RoutePath tail(float advance)
142 {
143 assert !this.destroyed.get() : "trying to use a destroyed object";
144 return native_tail(this.nativeRef, advance);
145 }
146 private native RoutePath native_tail(long _nativeRef, float advance);
147
148 @Override
149 public float getLength()
150 {
151 assert !this.destroyed.get() : "trying to use a destroyed object";
152 return native_getLength(this.nativeRef);
153 }
154 private native float native_getLength(long _nativeRef);
155
156 @Override
157 public ArrayList<RouteEvent> getEvents()
158 {
159 assert !this.destroyed.get() : "trying to use a destroyed object";
160 return native_getEvents(this.nativeRef);
161 }
162 private native ArrayList<RouteEvent> native_getEvents(long _nativeRef);
163
164 @Override
165 public ArrayList<LocationPoint> getPoints()
166 {
167 assert !this.destroyed.get() : "trying to use a destroyed object";
168 return native_getPoints(this.nativeRef);
169 }
170 private native ArrayList<LocationPoint> native_getPoints(long _nativeRef);
171 }
172}