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 {
28
37 public abstract ArrayList<RoutePath> makeRoutes(LocationPoint from, ArrayList<LocationPoint> to);
38
46 public abstract void setTarget(LocationPoint target);
47
55 public abstract void addTarget(LocationPoint target);
56
62 public abstract void cancelTarget();
63
69 public abstract void clearTargets();
70
76 public abstract void setGraphTag(String tag);
77
83 public abstract String getGraphTag();
84
90 public abstract ArrayList<String> getGraphTags();
91
100 public abstract void addRouteListener(RouteListener listener);
101
108 public abstract void removeRouteListener(RouteListener listener);
109
110 private static final class CppProxy extends RouteManager
111 {
112 private final long nativeRef;
113 private final AtomicBoolean destroyed = new AtomicBoolean(false);
114
115 private CppProxy(long nativeRef)
116 {
117 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
118 this.nativeRef = nativeRef;
119 }
120
121 private native void nativeDestroy(long nativeRef);
122 public void _djinni_private_destroy()
123 {
124 boolean destroyed = this.destroyed.getAndSet(true);
125 if (!destroyed) nativeDestroy(this.nativeRef);
126 }
127 protected void finalize() throws java.lang.Throwable
128 {
129 _djinni_private_destroy();
130 super.finalize();
131 }
132
133 // RouteManager methods
134
135 @Override
136 public RoutePath makeRoute(LocationPoint from, LocationPoint to)
137 {
138 assert !this.destroyed.get() : "trying to use a destroyed object";
139 return native_makeRoute(this.nativeRef, from, to);
140 }
141 private native RoutePath native_makeRoute(long _nativeRef, LocationPoint from, LocationPoint to);
142
143 @Override
144 public ArrayList<RoutePath> makeRoutes(LocationPoint from, ArrayList<LocationPoint> to)
145 {
146 assert !this.destroyed.get() : "trying to use a destroyed object";
147 return native_makeRoutes(this.nativeRef, from, to);
148 }
149 private native ArrayList<RoutePath> native_makeRoutes(long _nativeRef, LocationPoint from, ArrayList<LocationPoint> to);
150
151 @Override
152 public void setTarget(LocationPoint target)
153 {
154 assert !this.destroyed.get() : "trying to use a destroyed object";
155 native_setTarget(this.nativeRef, target);
156 }
157 private native void native_setTarget(long _nativeRef, LocationPoint target);
158
159 @Override
160 public void addTarget(LocationPoint target)
161 {
162 assert !this.destroyed.get() : "trying to use a destroyed object";
163 native_addTarget(this.nativeRef, target);
164 }
165 private native void native_addTarget(long _nativeRef, LocationPoint target);
166
167 @Override
168 public void cancelTarget()
169 {
170 assert !this.destroyed.get() : "trying to use a destroyed object";
171 native_cancelTarget(this.nativeRef);
172 }
173 private native void native_cancelTarget(long _nativeRef);
174
175 @Override
176 public void clearTargets()
177 {
178 assert !this.destroyed.get() : "trying to use a destroyed object";
179 native_clearTargets(this.nativeRef);
180 }
181 private native void native_clearTargets(long _nativeRef);
182
183 @Override
184 public void setGraphTag(String tag)
185 {
186 assert !this.destroyed.get() : "trying to use a destroyed object";
187 native_setGraphTag(this.nativeRef, tag);
188 }
189 private native void native_setGraphTag(long _nativeRef, String tag);
190
191 @Override
192 public String getGraphTag()
193 {
194 assert !this.destroyed.get() : "trying to use a destroyed object";
195 return native_getGraphTag(this.nativeRef);
196 }
197 private native String native_getGraphTag(long _nativeRef);
198
199 @Override
200 public ArrayList<String> getGraphTags()
201 {
202 assert !this.destroyed.get() : "trying to use a destroyed object";
203 return native_getGraphTags(this.nativeRef);
204 }
205 private native ArrayList<String> native_getGraphTags(long _nativeRef);
206
207 @Override
208 public void addRouteListener(RouteListener listener)
209 {
210 assert !this.destroyed.get() : "trying to use a destroyed object";
211 native_addRouteListener(this.nativeRef, listener);
212 }
213 private native void native_addRouteListener(long _nativeRef, RouteListener listener);
214
215 @Override
216 public void removeRouteListener(RouteListener listener)
217 {
218 assert !this.destroyed.get() : "trying to use a destroyed object";
219 native_removeRouteListener(this.nativeRef, listener);
220 }
221 private native void native_removeRouteListener(long _nativeRef, RouteListener listener);
222 }
223}