Loading...
Searching...
No Matches
Zone.java
Go to the documentation of this file.
1package com.navigine.idl.java;
2
3import java.util.concurrent.atomic.AtomicBoolean;
4
17public abstract class Zone {
21 public abstract Polygon getPolygon();
22
26 public abstract int getLocationId();
27
31 public abstract int getSublocationId();
32
36 public abstract int getId();
37
41 public abstract String getName();
42
46 public abstract String getColor();
47
51 public abstract String getAlias();
52
53 private static final class CppProxy extends Zone
54 {
55 private final long nativeRef;
56 private final AtomicBoolean destroyed = new AtomicBoolean(false);
57
58 private CppProxy(long nativeRef)
59 {
60 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
61 this.nativeRef = nativeRef;
62 }
63
64 private native void nativeDestroy(long nativeRef);
65 public void _djinni_private_destroy()
66 {
67 boolean destroyed = this.destroyed.getAndSet(true);
68 if (!destroyed) nativeDestroy(this.nativeRef);
69 }
70 protected void finalize() throws java.lang.Throwable
71 {
72 _djinni_private_destroy();
73 super.finalize();
74 }
75
76 // Zone methods
77
78 @Override
79 public Polygon getPolygon()
80 {
81 assert !this.destroyed.get() : "trying to use a destroyed object";
82 return native_getPolygon(this.nativeRef);
83 }
84 private native Polygon native_getPolygon(long _nativeRef);
85
86 @Override
87 public int getLocationId()
88 {
89 assert !this.destroyed.get() : "trying to use a destroyed object";
90 return native_getLocationId(this.nativeRef);
91 }
92 private native int native_getLocationId(long _nativeRef);
93
94 @Override
95 public int getSublocationId()
96 {
97 assert !this.destroyed.get() : "trying to use a destroyed object";
98 return native_getSublocationId(this.nativeRef);
99 }
100 private native int native_getSublocationId(long _nativeRef);
101
102 @Override
103 public int getId()
104 {
105 assert !this.destroyed.get() : "trying to use a destroyed object";
106 return native_getId(this.nativeRef);
107 }
108 private native int native_getId(long _nativeRef);
109
110 @Override
111 public String getName()
112 {
113 assert !this.destroyed.get() : "trying to use a destroyed object";
114 return native_getName(this.nativeRef);
115 }
116 private native String native_getName(long _nativeRef);
117
118 @Override
119 public String getColor()
120 {
121 assert !this.destroyed.get() : "trying to use a destroyed object";
122 return native_getColor(this.nativeRef);
123 }
124 private native String native_getColor(long _nativeRef);
125
126 @Override
127 public String getAlias()
128 {
129 assert !this.destroyed.get() : "trying to use a destroyed object";
130 return native_getAlias(this.nativeRef);
131 }
132 private native String native_getAlias(long _nativeRef);
133 }
134}