Loading...
Searching...
No Matches
LocationListManager.java
Go to the documentation of this file.
1package com.navigine.idl.java;
2
3import java.util.HashMap;
4import java.util.concurrent.atomic.AtomicBoolean;
5
17public abstract class LocationListManager {
34 public abstract void addLocationListListener(LocationListListener listener);
35
50 public abstract void removeLocationListListener(LocationListListener listener);
51
65 public abstract void updateLocationList();
66
81 public abstract HashMap<Integer, LocationInfo> getLocationList();
82
83 private static final class CppProxy extends LocationListManager
84 {
85 private final long nativeRef;
86 private final AtomicBoolean destroyed = new AtomicBoolean(false);
87
88 private CppProxy(long nativeRef)
89 {
90 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
91 this.nativeRef = nativeRef;
92 }
93
94 private native void nativeDestroy(long nativeRef);
95 public void _djinni_private_destroy()
96 {
97 boolean destroyed = this.destroyed.getAndSet(true);
98 if (!destroyed) nativeDestroy(this.nativeRef);
99 }
100 protected void finalize() throws java.lang.Throwable
101 {
102 _djinni_private_destroy();
103 super.finalize();
104 }
105
106 // LocationListManager methods
107
108 @Override
109 public void addLocationListListener(LocationListListener listener)
110 {
111 assert !this.destroyed.get() : "trying to use a destroyed object";
112 native_addLocationListListener(this.nativeRef, listener);
113 }
114 private native void native_addLocationListListener(long _nativeRef, LocationListListener listener);
115
116 @Override
117 public void removeLocationListListener(LocationListListener listener)
118 {
119 assert !this.destroyed.get() : "trying to use a destroyed object";
120 native_removeLocationListListener(this.nativeRef, listener);
121 }
122 private native void native_removeLocationListListener(long _nativeRef, LocationListListener listener);
123
124 @Override
125 public void updateLocationList()
126 {
127 assert !this.destroyed.get() : "trying to use a destroyed object";
128 native_updateLocationList(this.nativeRef);
129 }
130 private native void native_updateLocationList(long _nativeRef);
131
132 @Override
133 public HashMap<Integer, LocationInfo> getLocationList()
134 {
135 assert !this.destroyed.get() : "trying to use a destroyed object";
136 return native_getLocationList(this.nativeRef);
137 }
138 private native HashMap<Integer, LocationInfo> native_getLocationList(long _nativeRef);
139 }
140}