org.simantics.databoard.accessor
Interface ArrayAccessor

All Superinterfaces:
Accessor
All Known Subinterfaces:
FileArrayAccessor
All Known Implementing Classes:
BinaryArray, JavaArray

public interface ArrayAccessor
extends Accessor


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.simantics.databoard.accessor.Accessor
Accessor.Listener
 
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.
 java.lang.Object get(int index, Binding valueBinding)
          Get a value
<T extends Accessor>
T
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.
 void remove(int index, int count)
          Remove an element at an index.
 void set(int index, Binding binding, java.lang.Object value)
          Replace a value container with a new value.
 void setValue(Binding binding, java.lang.Object newValue)
          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 interface org.simantics.databoard.accessor.Accessor
addListener, apply, getAccessor, getValue, removeListener
 

Method Detail

add

void add(Binding binding,
         java.lang.Object value)
         throws AccessorException
Add a new value.

Parameters:
binding -
value - value
Throws:
AccessorException

addAll

void addAll(Binding binding,
            java.lang.Object[] values)
            throws AccessorException
Add an array of elements.

Parameters:
binding -
values - value
Throws:
AccessorException

addAll

void addAll(int index,
            Binding binding,
            java.lang.Object[] values)
            throws AccessorException
Add an array of elements. If elements are inserted in the middle of the array, existing interest sets are updated to reflect the new positions.

Parameters:
index - position to insert new value to
binding -
values -
Throws:
AccessorException

add

void add(int index,
         Binding binding,
         java.lang.Object value)
         throws AccessorException
Insert a new value. If elements are inserted in the middle of the array, existing interest sets are updated to reflect the new positions.

Parameters:
index - position to insert new value to
binding -
value - value
Throws:
AccessorException

setValue

void setValue(Binding binding,
              java.lang.Object newValue)
              throws AccessorException
Set all elements from an Array Value. If array becomes shorter and there are accessors to the removed elements, the accessors are invalidated.

Specified by:
setValue in interface Accessor
Parameters:
binding -
newValue -
Throws:
BindingException - binding error
java.lang.UnsupportedOperationException - cannot set a new value
AccessorException

set

void set(int index,
         Binding binding,
         java.lang.Object value)
         throws AccessorException
Replace a value container with a new value.

Parameters:
index -
binding -
value -
Throws:
AccessorException

remove

void remove(int index,
            int count)
            throws AccessorException
Remove an element at an index. If there are listeners to elements after the index, the interest sets and accessor paths are updated and decreased. If there was an accessor, it becomes invalid.

Parameters:
index -
count -
Throws:
AccessorException

getAccessor

<T extends Accessor> T getAccessor(int index)
                               throws AccessorConstructionException
Get an accessor to an element. The accessor is invalidated if the element is removed from the array.

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].

Parameters:
index -
Returns:
the accessor
Throws:
AccessorConstructionException

get

java.lang.Object get(int index,
                     Binding valueBinding)
                     throws AccessorException
Get a value

Parameters:
index -
valueBinding -
Returns:
the element
Throws:
AccessorException

getAll

void getAll(Binding valueBinding,
            java.lang.Object[] array)
            throws AccessorException
Get all elements and place them to an array. Exception is thrown if Array length is too short.

Parameters:
valueBinding -
array -
Throws:
AccessorException

getAll

void getAll(Binding valueBinding,
            java.util.Collection<java.lang.Object> values)
            throws AccessorException
Get all elements

Parameters:
valueBinding -
values -
Throws:
AccessorException

size

int size()
         throws AccessorException
Return the number of elements in the array.

Returns:
the number of elements
Throws:
AccessorException

type

ArrayType type()
Description copied from interface: Accessor
Get structural represtentation of the accessor presented in databoard's type system.

Specified by:
type in interface Accessor
Returns:
type description