|
|||||||||
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.JavaArray
public class JavaArray
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.simantics.databoard.accessor.Accessor |
---|
Accessor.Listener |
Constructor Summary | |
---|---|
JavaArray(Accessor parent,
ArrayBinding binding,
java.lang.Object object,
AccessorParams params)
|
Method Summary | ||
---|---|---|
void |
add(Binding binding,
java.lang.Object value)
Add a new value. |
|
void |
add(int index,
Binding binding,
java.lang.Object value)
Insert a new value. |
|
void |
addAll(Binding binding,
java.lang.Object[] values)
Add an array of elements. |
|
void |
addAll(int index,
Binding binding,
java.lang.Object[] values)
Add an array of elements. |
|
void |
addListener(Accessor.Listener listener,
InterestSet interestSet,
ChildReference path)
Place a listener to an accessor node. |
|
java.lang.Object |
get(int index,
Binding valueBinding)
Get a value |
|
|
getAccessor(int index)
Get an accessor to an element. |
|
void |
getAll(Binding valueBinding,
java.util.Collection<java.lang.Object> values)
Get all elements |
|
void |
getAll(Binding valueBinding,
java.lang.Object[] array)
Get all elements and place them to an array . |
|
ArrayBinding |
getBinding()
|
|
|
getComponent(ChildReference reference)
Open an accessor to a child. |
|
void |
remove(int index,
int count)
Remove an element at an index. |
|
void |
removeListener(Accessor.Listener listener)
Remove a listener. |
|
void |
set(int index,
Binding binding,
java.lang.Object value)
Replace a value container with a new value. |
|
void |
setSize(int newSize)
|
|
void |
setValue(Binding arrayBinding,
java.lang.Object newArray)
Set all elements from an Array Value. |
|
int |
size()
Return the number of elements in the array. |
|
ArrayType |
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, getEmitter, 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 JavaArray(Accessor parent, ArrayBinding binding, java.lang.Object object, AccessorParams params)
Method Detail |
---|
public ArrayBinding getBinding()
getBinding
in class JavaObject
public ArrayType type()
Accessor
type
in interface Accessor
type
in interface ArrayAccessor
type
in class JavaObject
public void add(Binding binding, java.lang.Object value) throws AccessorException
ArrayAccessor
add
in interface ArrayAccessor
value
- value
AccessorException
public void addAll(Binding binding, java.lang.Object[] values) throws AccessorException
ArrayAccessor
addAll
in interface ArrayAccessor
values
- value
AccessorException
public void add(int index, Binding binding, java.lang.Object value) throws AccessorException
ArrayAccessor
add
in interface ArrayAccessor
index
- position to insert new value tovalue
- value
AccessorException
public void addAll(int index, Binding binding, java.lang.Object[] values) throws AccessorException
ArrayAccessor
addAll
in interface ArrayAccessor
index
- position to insert new value to
AccessorException
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 <T extends Accessor> T getAccessor(int index) throws AccessorConstructionException
ArrayAccessor
The accessor is not to the index, it is to the element. For instance, you get accessor X of [2] then a new value is inserted before 2. The accessor now points to the element at [3].
getAccessor
in interface ArrayAccessor
AccessorConstructionException
public void getAll(Binding valueBinding, java.util.Collection<java.lang.Object> values) throws AccessorException
ArrayAccessor
getAll
in interface ArrayAccessor
AccessorException
public void getAll(Binding valueBinding, java.lang.Object[] array) throws AccessorException
ArrayAccessor
array
.
Exception is thrown if Array length is too short.
getAll
in interface ArrayAccessor
AccessorException
public java.lang.Object get(int index, Binding valueBinding) throws AccessorException
ArrayAccessor
get
in interface ArrayAccessor
AccessorException
public void remove(int index, int count) throws AccessorException
ArrayAccessor
index
, the
interest sets and accessor paths are updated and decreased.
If there was an accessor, it becomes invalid.
remove
in interface ArrayAccessor
AccessorException
public void set(int index, Binding binding, java.lang.Object value) throws AccessorException
ArrayAccessor
set
in interface ArrayAccessor
AccessorException
public void setValue(Binding arrayBinding, java.lang.Object newArray) throws AccessorException
ArrayAccessor
setValue
in interface Accessor
setValue
in interface ArrayAccessor
AccessorException
public void setSize(int newSize) throws AccessorException
setSize
in interface ArrayAccessor
AccessorException
public int size() throws AccessorException
ArrayAccessor
size
in interface ArrayAccessor
AccessorException
public void addListener(Accessor.Listener listener, InterestSet interestSet, ChildReference path) 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.
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 |