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 {
26 public abstract void addLocationListListener(LocationListListener listener);
27
34 public abstract void removeLocationListListener(LocationListListener listener);
35
41 public abstract void updateLocationList();
42
49 public abstract HashMap<Integer, LocationInfo> getLocationList();
50
51 private static final class CppProxy extends LocationListManager
52 {
53 private final long nativeRef;
54 private final AtomicBoolean destroyed = new AtomicBoolean(false);
55
56 private CppProxy(long nativeRef)
57 {
58 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
59 this.nativeRef = nativeRef;
60 }
61
62 private native void nativeDestroy(long nativeRef);
63 public void _djinni_private_destroy()
64 {
65 boolean destroyed = this.destroyed.getAndSet(true);
66 if (!destroyed) nativeDestroy(this.nativeRef);
67 }
68 protected void finalize() throws java.lang.Throwable
69 {
70 _djinni_private_destroy();
71 super.finalize();
72 }
73
74 // LocationListManager methods
75
76 @Override
77 public void addLocationListListener(LocationListListener listener)
78 {
79 assert !this.destroyed.get() : "trying to use a destroyed object";
80 native_addLocationListListener(this.nativeRef, listener);
81 }
82 private native void native_addLocationListListener(long _nativeRef, LocationListListener listener);
83
84 @Override
85 public void removeLocationListListener(LocationListListener listener)
86 {
87 assert !this.destroyed.get() : "trying to use a destroyed object";
88 native_removeLocationListListener(this.nativeRef, listener);
89 }
90 private native void native_removeLocationListListener(long _nativeRef, LocationListListener listener);
91
92 @Override
93 public void updateLocationList()
94 {
95 assert !this.destroyed.get() : "trying to use a destroyed object";
96 native_updateLocationList(this.nativeRef);
97 }
98 private native void native_updateLocationList(long _nativeRef);
99
100 @Override
101 public HashMap<Integer, LocationInfo> getLocationList()
102 {
103 assert !this.destroyed.get() : "trying to use a destroyed object";
104 return native_getLocationList(this.nativeRef);
105 }
106 private native HashMap<Integer, LocationInfo> native_getLocationList(long _nativeRef);
107 }
108}