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
18public abstract class RoutePath {
34 public abstract RoutePath head(float advance);
35
51 public abstract RoutePath tail(float advance);
52
66 public abstract ArrayList<RouteNode> nodes();
67
81 public abstract float getLength();
82
96 public abstract float getWeight();
97
98 private static final class CppProxy extends RoutePath
99 {
100 private final long nativeRef;
101 private final AtomicBoolean destroyed = new AtomicBoolean(false);
102
103 private CppProxy(long nativeRef)
104 {
105 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
106 this.nativeRef = nativeRef;
107 }
108
109 private native void nativeDestroy(long nativeRef);
110 public void _djinni_private_destroy()
111 {
112 boolean destroyed = this.destroyed.getAndSet(true);
113 if (!destroyed) nativeDestroy(this.nativeRef);
114 }
115 protected void finalize() throws java.lang.Throwable
116 {
117 _djinni_private_destroy();
118 super.finalize();
119 }
120
121 // RoutePath methods
122
123 @Override
124 public RoutePath head(float advance)
125 {
126 assert !this.destroyed.get() : "trying to use a destroyed object";
127 return native_head(this.nativeRef, advance);
128 }
129 private native RoutePath native_head(long _nativeRef, float advance);
130
131 @Override
132 public RoutePath tail(float advance)
133 {
134 assert !this.destroyed.get() : "trying to use a destroyed object";
135 return native_tail(this.nativeRef, advance);
136 }
137 private native RoutePath native_tail(long _nativeRef, float advance);
138
139 @Override
140 public ArrayList<RouteNode> nodes()
141 {
142 assert !this.destroyed.get() : "trying to use a destroyed object";
143 return native_nodes(this.nativeRef);
144 }
145 private native ArrayList<RouteNode> native_nodes(long _nativeRef);
146
147 @Override
148 public float getLength()
149 {
150 assert !this.destroyed.get() : "trying to use a destroyed object";
151 return native_getLength(this.nativeRef);
152 }
153 private native float native_getLength(long _nativeRef);
154
155 @Override
156 public float getWeight()
157 {
158 assert !this.destroyed.get() : "trying to use a destroyed object";
159 return native_getWeight(this.nativeRef);
160 }
161 private native float native_getWeight(long _nativeRef);
162 }
163}