Commit 310cff57 authored by Nico Mack's avatar Nico Mack

Switch from low-level rJava API to high-level API in Rexecutor.

Implemented modification behavior for both Map and VectorVariables.
parent c54465c5
......@@ -157,6 +157,11 @@
<artifactId>REngine</artifactId>
<version>0.9-7</version>
</dependency>
<dependency>
<groupId>com.github.lucarosellini.rJava</groupId>
<artifactId>JRIEngine</artifactId>
<version>0.9-7</version>
</dependency>
</dependencies>
<repositories>
......
......@@ -106,6 +106,7 @@ public class MapVariable<K, V> extends Variable<Map<K, V>> implements Map<K, V>
@Override
public V put(K key, V newValue) {
this.modified = true;
return value.put(key, newValue);
}
......@@ -114,6 +115,7 @@ public class MapVariable<K, V> extends Variable<Map<K, V>> implements Map<K, V>
// ---------------------------------------------------------------------------
@Override
public V remove(Object key) {
this.modified = true;
return value.remove(key);
}
......@@ -133,7 +135,7 @@ public class MapVariable<K, V> extends Variable<Map<K, V>> implements Map<K, V>
@Override
public void clear() {
value.clear();
this.modified = true;
}
// ---------------------------------------------------------------------------
......@@ -175,6 +177,7 @@ public class MapVariable<K, V> extends Variable<Map<K, V>> implements Map<K, V>
this.value = new ConcurrentHashMap<K, V>();
}
this.value.putAll(this.valueFromObject(object));
this.modified = true;
}
// ---------------------------------------------------------------------------
......
......@@ -141,19 +141,19 @@ public class VectorVariable<B> extends Variable<List<B>> implements List<B> {
@SuppressWarnings("unchecked")
@Override
public boolean add(Object e) {
boolean hasChanged = value.add((B) e);
if (hasChanged)
this.modified = value.add((B) e);
if (this.modified)
this.notifyInputChangeListeners();
return hasChanged;
return this.modified;
}
/** {@inheritDoc} */
@Override
public boolean remove(Object o) {
boolean hasChanged = value.remove(o);
if (hasChanged)
this.modified = value.remove(o);
if (this.modified)
this.notifyInputChangeListeners();
return hasChanged;
return this.modified;
}
/** {@inheritDoc} */
......@@ -195,18 +195,21 @@ public class VectorVariable<B> extends Variable<List<B>> implements List<B> {
/** {@inheritDoc} */
@Override
public B set(int index, B element) {
this.modified = true;
return value.set(index, element);
}
/** {@inheritDoc} */
@Override
public void add(int index, B element) {
this.modified = true;
value.add(index, element);
}
/** {@inheritDoc} */
@Override
public B remove(int index) {
this.modified = true;
return value.remove(index);
}
......@@ -244,7 +247,8 @@ public class VectorVariable<B> extends Variable<List<B>> implements List<B> {
@Override
public void clear() {
if (value != null)
value.clear();
this.modified = true;
value.clear();
}
/** {@inheritDoc} */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment