Loading...
Searching...
No Matches
Location.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 Location {
28 public abstract ElevationGraph getElevationGraph(String tag);
29
34 public abstract ArrayList<String> getGraphTags();
35
41 public abstract Sublocation getSublocationById(int id);
42
48 public abstract Category getCategoryById(int id);
49
53 public abstract int getId();
54
58 public abstract int getVersion();
59
63 public abstract String getName();
64
68 public abstract String getDescript();
69
73 public abstract ArrayList<Category> getCategories();
74
78 public abstract ArrayList<Sublocation> getSublocations();
79
83 public abstract boolean getModified();
84
85 private static final class CppProxy extends Location
86 {
87 private final long nativeRef;
88 private final AtomicBoolean destroyed = new AtomicBoolean(false);
89
90 private CppProxy(long nativeRef)
91 {
92 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
93 this.nativeRef = nativeRef;
94 }
95
96 private native void nativeDestroy(long nativeRef);
97 public void _djinni_private_destroy()
98 {
99 boolean destroyed = this.destroyed.getAndSet(true);
100 if (!destroyed) nativeDestroy(this.nativeRef);
101 }
102 protected void finalize() throws java.lang.Throwable
103 {
104 _djinni_private_destroy();
105 super.finalize();
106 }
107
108 // Location methods
109
110 @Override
111 public ElevationGraph getElevationGraph(String tag)
112 {
113 assert !this.destroyed.get() : "trying to use a destroyed object";
114 return native_getElevationGraph(this.nativeRef, tag);
115 }
116 private native ElevationGraph native_getElevationGraph(long _nativeRef, String tag);
117
118 @Override
119 public ArrayList<String> getGraphTags()
120 {
121 assert !this.destroyed.get() : "trying to use a destroyed object";
122 return native_getGraphTags(this.nativeRef);
123 }
124 private native ArrayList<String> native_getGraphTags(long _nativeRef);
125
126 @Override
127 public Sublocation getSublocationById(int id)
128 {
129 assert !this.destroyed.get() : "trying to use a destroyed object";
130 return native_getSublocationById(this.nativeRef, id);
131 }
132 private native Sublocation native_getSublocationById(long _nativeRef, int id);
133
134 @Override
135 public Category getCategoryById(int id)
136 {
137 assert !this.destroyed.get() : "trying to use a destroyed object";
138 return native_getCategoryById(this.nativeRef, id);
139 }
140 private native Category native_getCategoryById(long _nativeRef, int id);
141
142 @Override
143 public int getId()
144 {
145 assert !this.destroyed.get() : "trying to use a destroyed object";
146 return native_getId(this.nativeRef);
147 }
148 private native int native_getId(long _nativeRef);
149
150 @Override
151 public int getVersion()
152 {
153 assert !this.destroyed.get() : "trying to use a destroyed object";
154 return native_getVersion(this.nativeRef);
155 }
156 private native int native_getVersion(long _nativeRef);
157
158 @Override
159 public String getName()
160 {
161 assert !this.destroyed.get() : "trying to use a destroyed object";
162 return native_getName(this.nativeRef);
163 }
164 private native String native_getName(long _nativeRef);
165
166 @Override
167 public String getDescript()
168 {
169 assert !this.destroyed.get() : "trying to use a destroyed object";
170 return native_getDescript(this.nativeRef);
171 }
172 private native String native_getDescript(long _nativeRef);
173
174 @Override
175 public ArrayList<Category> getCategories()
176 {
177 assert !this.destroyed.get() : "trying to use a destroyed object";
178 return native_getCategories(this.nativeRef);
179 }
180 private native ArrayList<Category> native_getCategories(long _nativeRef);
181
182 @Override
183 public ArrayList<Sublocation> getSublocations()
184 {
185 assert !this.destroyed.get() : "trying to use a destroyed object";
186 return native_getSublocations(this.nativeRef);
187 }
188 private native ArrayList<Sublocation> native_getSublocations(long _nativeRef);
189
190 @Override
191 public boolean getModified()
192 {
193 assert !this.destroyed.get() : "trying to use a destroyed object";
194 return native_getModified(this.nativeRef);
195 }
196 private native boolean native_getModified(long _nativeRef);
197 }
198}