plugins.adufour.vars.lang
Class VarMutableArray

java.lang.Object
  extended by plugins.adufour.vars.lang.Var
      extended by plugins.adufour.vars.lang.VarMutable
          extended by plugins.adufour.vars.lang.VarMutableArray
All Implemented Interfaces:
icy.file.xml.XMLPersistent, MutableType, VarListener

public class VarMutableArray
extends VarMutable

Variable holding an array of mutable type

Author:
Alexandre Dufour

Field Summary
 
Fields inherited from class plugins.adufour.vars.lang.Var
NO_VALUE, type, XML_KEY_ID
 
Constructor Summary
VarMutableArray(java.lang.String name, java.lang.Class<?> initialType)
           
 
Method Summary
<T> T
getElementAt(int index)
           
 boolean isAssignableFrom(Var source)
          Checks whether the type of the given variable is equal or extends this variable's type.
If the result is true, then the given variable can become a link source for this variable
 int size()
           
 
Methods inherited from class plugins.adufour.vars.lang.VarMutable
addTypeChangeListener, createVarEditor, createVarViewer, removeTypeChangeListener, setDefaultEditorModel, setReference, setType, setValue
 
Methods inherited from class plugins.adufour.vars.lang.Var
addListener, fireVariableChanged, fireVariableChanged, getDefaultEditorModel, getDefaultValue, getIterableReferrers, getName, getReference, getReferencingPolicy, getReferrers, getType, getTypeAsString, getValue, getValue, getValueAsString, getValueAsString, isEnabled, isOptional, isReferenced, loadFromXML, parse, prettyPrint, referenceChanged, removeListener, removeListeners, saveToXML, setEnabled, setOptional, setReferencingPolicy, toString, valueChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VarMutableArray

public VarMutableArray(java.lang.String name,
                       java.lang.Class<?> initialType)
Method Detail

isAssignableFrom

public boolean isAssignableFrom(Var source)
Description copied from class: Var
Checks whether the type of the given variable is equal or extends this variable's type.
If the result is true, then the given variable can become a link source for this variable

Overrides:
isAssignableFrom in class VarMutable
Returns:
true if the source type is equal or wider than this variable's type, false otherwise (including if source has null type)

getElementAt

public <T> T getElementAt(int index)
               throws java.lang.NullPointerException,
                      java.lang.ClassCastException
Parameters:
index - the index to retrieve
Returns:
the array element at the specified index
Throws:
java.lang.NullPointerException - if the variable value is null
java.lang.ClassCastException - if the inferred type is incompatible with the array element

size

public int size()
Returns:
The size of this array, or -1 if the array is null