|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.simantics.databoard.accessor.java.JavaObject
org.simantics.databoard.accessor.java.JavaMap
public class JavaMap
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.simantics.databoard.accessor.Accessor |
---|
Accessor.Listener |
Constructor Summary | |
---|---|
JavaMap(Accessor parent,
MapBinding binding,
java.lang.Object object,
AccessorParams params)
|
Method Summary | ||
---|---|---|
void |
addListener(Accessor.Listener listener,
InterestSet interestSet,
ChildReference path,
java.util.concurrent.Executor executor)
Place a listener to an accessor node. |
|
void |
clear()
Clear all entries. |
|
boolean |
containsKey(Binding keyBinding,
java.lang.Object key)
Returns true if map has a value for specified key |
|
boolean |
containsValue(Binding valueBinding,
java.lang.Object value)
Returns true if map has a value for one or multiple keys |
|
int |
count(Binding keyBinding,
java.lang.Object from,
boolean fromInclusive,
java.lang.Object end,
boolean endInclusive)
Count the number of entries between two keyes |
|
java.lang.Object |
get(Binding keyBinding,
java.lang.Object key,
Binding valueBinding)
Get the value that is specified for a key |
|
void |
getAll(Binding keyBinding,
Binding valueBinding,
java.util.Map<java.lang.Object,java.lang.Object> to)
Get all entries, write to a Java Collection |
|
void |
getAll(Binding keyBinding,
Binding valueBinding,
java.lang.Object[] keys,
java.lang.Object[] values)
Get all entries in order, write to 2 arrays. |
|
MapBinding |
getBinding()
|
|
java.lang.Object |
getCeilingKey(Binding keyBinding,
java.lang.Object key)
|
|
|
getComponent(ChildReference reference)
Open an accessor to a child. |
|
int |
getEntries(Binding keyBinding,
java.lang.Object from,
boolean fromInclusive,
java.lang.Object end,
boolean endInclusive,
ArrayBinding keyArrayBinding,
java.lang.Object keysArray,
ArrayBinding valueArrayBinding,
java.lang.Object valueArray,
int limit)
Read a range of entries |
|
java.lang.Object |
getFirstKey(Binding keyBinding)
|
|
java.lang.Object |
getFloorKey(Binding keyBinding,
java.lang.Object key)
|
|
java.lang.Object |
getHigherKey(Binding keyBinding,
java.lang.Object key)
|
|
Binding |
getKeyBinding()
|
|
java.lang.Object[] |
getKeys(Binding keyBinding)
Get all keys in order |
|
java.lang.Object |
getLastKey(Binding keyBinding)
|
|
java.lang.Object |
getLowerKey(Binding keyBinding,
java.lang.Object key)
|
|
|
getValueAccessor(Binding keyBinding,
java.lang.Object key)
Get an accessor to a value. |
|
Binding |
getValueBinding()
|
|
java.lang.Object[] |
getValues(Binding valueBinding)
Get all values |
|
void |
put(Binding keyBinding,
java.lang.Object key,
Binding valueBinding,
java.lang.Object value)
Put an entry to the map. |
|
void |
putAll(Binding keyBinding,
Binding valueBinding,
java.util.Map<java.lang.Object,java.lang.Object> from)
Put entries from a map. |
|
void |
putAll(Binding keyBinding,
Binding valueBinding,
java.lang.Object[] keys,
java.lang.Object[] values)
Put entries from a map. |
|
void |
remove(Binding keyBinding,
java.lang.Object key)
Remove an entry. |
|
void |
removeListener(Accessor.Listener listener)
Remove a listener. |
|
void |
setValue(Binding mapBinding,
java.lang.Object newMap)
Set & copy all entries from a Map Value. |
|
int |
size()
Get the number of elements in the map |
|
MapType |
type()
Get structural represtentation of the accessor presented in databoard's type system. |
Methods inherited from class org.simantics.databoard.accessor.java.JavaObject |
---|
apply, createAccessor, createSubAccessor, getObject, getParams, getReadLock, getValue, getValue, getWriteLock, notifyValueChanged, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.simantics.databoard.accessor.Accessor |
---|
apply, getValue, getValue |
Constructor Detail |
---|
public JavaMap(Accessor parent, MapBinding binding, java.lang.Object object, AccessorParams params)
Method Detail |
---|
public MapType type()
Accessor
type
in interface Accessor
type
in interface MapAccessor
type
in class JavaObject
public MapBinding getBinding()
getBinding
in class JavaObject
public Binding getKeyBinding()
public Binding getValueBinding()
public void clear() throws AccessorException
MapAccessor
clear
in interface MapAccessor
AccessorException
public void put(Binding keyBinding, java.lang.Object key, Binding valueBinding, java.lang.Object value) throws AccessorException
MapAccessor
put
in interface MapAccessor
AccessorException
public void putAll(Binding keyBinding, Binding valueBinding, java.util.Map<java.lang.Object,java.lang.Object> from) throws AccessorException
MapAccessor
putAll
in interface MapAccessor
AccessorException
public void putAll(Binding keyBinding, Binding valueBinding, java.lang.Object[] keys, java.lang.Object[] values) throws AccessorException
MapAccessor
putAll
in interface MapAccessor
AccessorException
public void remove(Binding keyBinding, java.lang.Object key) throws AccessorException
MapAccessor
remove
in interface MapAccessor
AccessorException
public void setValue(Binding mapBinding, java.lang.Object newMap) throws AccessorException
MapAccessor
setValue
in interface Accessor
setValue
in interface MapAccessor
AccessorException
public <T extends Accessor> T getValueAccessor(Binding keyBinding, java.lang.Object key) throws AccessorConstructionException
MapAccessor
getValueAccessor
in interface MapAccessor
AccessorConstructionException
public <T extends Accessor> T getComponent(ChildReference reference) throws AccessorConstructionException
Accessor
InvalidatedEvent is thrown from the accessor if it is unlinked from the parent hierarchy.
getComponent
in interface Accessor
reference
- component reference path or null
to return _this_ accessor
AccessorConstructionException
public int size() throws AccessorException
MapAccessor
size
in interface MapAccessor
AccessorException
public boolean containsKey(Binding keyBinding, java.lang.Object key) throws AccessorException
MapAccessor
containsKey
in interface MapAccessor
AccessorException
public boolean containsValue(Binding valueBinding, java.lang.Object value) throws AccessorException
MapAccessor
containsValue
in interface MapAccessor
AccessorException
public java.lang.Object get(Binding keyBinding, java.lang.Object key, Binding valueBinding) throws AccessorException
MapAccessor
get
in interface MapAccessor
null
AccessorException
public int count(Binding keyBinding, java.lang.Object from, boolean fromInclusive, java.lang.Object end, boolean endInclusive) throws AccessorException
MapAccessor
count
in interface MapAccessor
AccessorException
public int getEntries(Binding keyBinding, java.lang.Object from, boolean fromInclusive, java.lang.Object end, boolean endInclusive, ArrayBinding keyArrayBinding, java.lang.Object keysArray, ArrayBinding valueArrayBinding, java.lang.Object valueArray, int limit) throws AccessorException
MapAccessor
getEntries
in interface MapAccessor
limit
- maximum number of entries to read, -1 for no limit
AccessorException
public void getAll(Binding keyBinding, Binding valueBinding, java.util.Map<java.lang.Object,java.lang.Object> to) throws AccessorException
MapAccessor
getAll
in interface MapAccessor
AccessorException
public void getAll(Binding keyBinding, Binding valueBinding, java.lang.Object[] keys, java.lang.Object[] values) throws AccessorException
MapAccessor
getAll
in interface MapAccessor
AccessorException
public java.lang.Object[] getKeys(Binding keyBinding) throws AccessorException
MapAccessor
getKeys
in interface MapAccessor
AccessorException
public java.lang.Object[] getValues(Binding valueBinding) throws AccessorException
MapAccessor
getValues
in interface MapAccessor
AccessorException
public java.lang.Object getCeilingKey(Binding keyBinding, java.lang.Object key) throws AccessorException
getCeilingKey
in interface MapAccessor
AccessorException
public java.lang.Object getFirstKey(Binding keyBinding) throws AccessorException
getFirstKey
in interface MapAccessor
AccessorException
public java.lang.Object getLastKey(Binding keyBinding) throws AccessorException
getLastKey
in interface MapAccessor
AccessorException
public java.lang.Object getFloorKey(Binding keyBinding, java.lang.Object key) throws AccessorException
getFloorKey
in interface MapAccessor
AccessorException
public java.lang.Object getHigherKey(Binding keyBinding, java.lang.Object key) throws AccessorException
getHigherKey
in interface MapAccessor
AccessorException
public java.lang.Object getLowerKey(Binding keyBinding, java.lang.Object key) throws AccessorException
getLowerKey
in interface MapAccessor
AccessorException
public void addListener(Accessor.Listener listener, InterestSet interestSet, ChildReference path, java.util.concurrent.Executor executor) throws AccessorException
Accessor
When events are emited and in which thread processed is implementation specific. It is also implementation specific, whether the object can be mutated in the listener or whether it has to be done afterwards.
In many implementations there is a pluggable event handling strategy EventEmitter. The default behaviour is to emit events as they are spawned in the current thread.
There is a reference in each event instance that describes the path from the accessor where listener was placed to the node to which the event applies to.
Listener is attached to the object that holds the value at the time at the of the adding. For example, If a listener is attached to an array of element at index 3, and a new value is inserted at position 2, the listener still monitors the same container, which is now at index 4. The references of incoming the events are modified to have the new index.
Also, if a new value is assigned to the parent of an object that is listened, the listener keeps on monitoring the new value at the same reference. This doesn't apply when a new value is set to a union of different tag, to a variant with a new type, or value is removed from Optional type. In these two cases the listener is invalidated.
See ChangeSet
is an implementation that collects events.
Executor argument determines the thread where the onEvents method is
handled. null argument denotes current thread.
addListener
in interface Accessor
addListener
in class JavaObject
path
- path to the accessor or null
. This is used in the events the accessor produces
AccessorException
collects events
public void removeListener(Accessor.Listener listener) throws AccessorException
Accessor
removeListener
in interface Accessor
removeListener
in class JavaObject
AccessorException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |