97 private long currentEncodedProperties;
98 private final boolean flipped;
99
100 public JRSUIControl(final boolean flipped){
101 this.flipped = flipped;
102 cfDictionaryPtr = getCFDictionary(flipped);
103 if (cfDictionaryPtr == 0) throw new RuntimeException("Unable to create native representation");
104 nativeMap = new HashMap<Key, DoubleValue>();
105 changes = new HashMap<Key, DoubleValue>();
106 }
107
108 JRSUIControl(final JRSUIControl other) {
109 flipped = other.flipped;
110 cfDictionaryPtr = getCFDictionary(flipped);
111 if (cfDictionaryPtr == 0) throw new RuntimeException("Unable to create native representation");
112 nativeMap = new HashMap<Key, DoubleValue>();
113 changes = new HashMap<Key, DoubleValue>(other.nativeMap);
114 changes.putAll(other.changes);
115 }
116
117 protected synchronized final void finalize() throws Throwable {
118 if (cfDictionaryPtr == 0) return;
119 disposeCFDictionary(cfDictionaryPtr);
120 cfDictionaryPtr = 0;
121 }
122
123
124 enum BufferState {
125 NO_CHANGE,
126 ALL_CHANGES_IN_BUFFER,
127 SOME_CHANGES_IN_BUFFER,
128 CHANGE_WONT_FIT_IN_BUFFER;
129 }
130
131 private BufferState loadBufferWithChanges(final ThreadLocalByteBuffer localByteBuffer) {
132 final ByteBuffer buffer = localByteBuffer.buffer;
133 buffer.rewind();
134
135 for (final JRSUIConstants.Key key : new HashSet<JRSUIConstants.Key>(changes.keySet())) {
136 final int changeIndex = buffer.position();
137 final JRSUIConstants.DoubleValue value = changes.get(key);
|
97 private long currentEncodedProperties;
98 private final boolean flipped;
99
100 public JRSUIControl(final boolean flipped){
101 this.flipped = flipped;
102 cfDictionaryPtr = getCFDictionary(flipped);
103 if (cfDictionaryPtr == 0) throw new RuntimeException("Unable to create native representation");
104 nativeMap = new HashMap<Key, DoubleValue>();
105 changes = new HashMap<Key, DoubleValue>();
106 }
107
108 JRSUIControl(final JRSUIControl other) {
109 flipped = other.flipped;
110 cfDictionaryPtr = getCFDictionary(flipped);
111 if (cfDictionaryPtr == 0) throw new RuntimeException("Unable to create native representation");
112 nativeMap = new HashMap<Key, DoubleValue>();
113 changes = new HashMap<Key, DoubleValue>(other.nativeMap);
114 changes.putAll(other.changes);
115 }
116
117 protected synchronized void finalize() throws Throwable {
118 if (cfDictionaryPtr == 0) return;
119 disposeCFDictionary(cfDictionaryPtr);
120 cfDictionaryPtr = 0;
121 }
122
123
124 enum BufferState {
125 NO_CHANGE,
126 ALL_CHANGES_IN_BUFFER,
127 SOME_CHANGES_IN_BUFFER,
128 CHANGE_WONT_FIT_IN_BUFFER;
129 }
130
131 private BufferState loadBufferWithChanges(final ThreadLocalByteBuffer localByteBuffer) {
132 final ByteBuffer buffer = localByteBuffer.buffer;
133 buffer.rewind();
134
135 for (final JRSUIConstants.Key key : new HashSet<JRSUIConstants.Key>(changes.keySet())) {
136 final int changeIndex = buffer.position();
137 final JRSUIConstants.DoubleValue value = changes.get(key);
|