Nengo.ca

ca.nengo.config.impl
Class TemplateArrayProperty

java.lang.Object
  extended by ca.nengo.config.impl.AbstractProperty
      extended by ca.nengo.config.impl.TemplateArrayProperty
All Implemented Interfaces:
ListProperty, Property

public class TemplateArrayProperty
extends AbstractProperty
implements ListProperty

A ListProperty that is not attached to getter/setter methods on an underlying class, but instead stores its values internally. It can be used to manage array or list values of constructor/method arguments (rather than multi-valued object properties). Similar to TemplateProperty but multivalued.


Constructor Summary
TemplateArrayProperty(Configuration configuration, java.lang.String name, java.lang.Class<?> c)
           
 
Method Summary
 void addValue(java.lang.Object value)
           
 java.lang.Object getDefaultValue()
           
 int getNumValues()
           
 java.lang.Object getValue(int index)
           
 void insert(int index, java.lang.Object value)
           
 boolean isFixedCardinality()
           
 void remove(int index)
           
 void setValue(int index, java.lang.Object value)
           
 
Methods inherited from class ca.nengo.config.impl.AbstractProperty
getConfiguration, getDefaultDocumentation, getDocumentation, getName, getType, isMutable, setDocumentation, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ca.nengo.config.Property
getDocumentation, getName, getType, isMutable, setName
 

Constructor Detail

TemplateArrayProperty

public TemplateArrayProperty(Configuration configuration,
                             java.lang.String name,
                             java.lang.Class<?> c)
Parameters:
configuration - Configuration to which this Property belongs
name - Name of the property
c - Type of the property value
Method Detail

addValue

public void addValue(java.lang.Object value)
              throws StructuralException
Specified by:
addValue in interface ListProperty
Parameters:
value - New value to be added to the end of the list
Throws:
StructuralException - if the value is invalid (as in setValue) or the Property is immutable or fixed-cardinality
See Also:
ListProperty.addValue(java.lang.Object)

getNumValues

public int getNumValues()
Specified by:
getNumValues in interface ListProperty
Returns:
Number of repeated values of this Property
See Also:
ListProperty.getNumValues()

getValue

public java.lang.Object getValue(int index)
                          throws StructuralException
Specified by:
getValue in interface ListProperty
Parameters:
index - Index of a certain single value of a multi-valued property
Returns:
The value at the given index
Throws:
StructuralException - if the given index is out of range
See Also:
ListProperty.getValue(int)

insert

public void insert(int index,
                   java.lang.Object value)
            throws StructuralException
Specified by:
insert in interface ListProperty
Parameters:
index - Index at which new value is to be inserted
value - New value
Throws:
StructuralException - if the value is invalid (as in setValue) or the Property is immutable or fixed-cardinality or the index is out of range
See Also:
ListProperty.insert(int, java.lang.Object)

isFixedCardinality

public boolean isFixedCardinality()
Specified by:
isFixedCardinality in interface Property
Returns:
True if the property has a fixed number of values
See Also:
Property.isFixedCardinality()

remove

public void remove(int index)
            throws StructuralException
Specified by:
remove in interface ListProperty
Parameters:
index - Index of a single value of a multi-valued property that is to be removed
Throws:
StructuralException - if the given index is out of range or the Property is immutable or fixed cardinality
See Also:
ListProperty.remove(int)

setValue

public void setValue(int index,
                     java.lang.Object value)
              throws StructuralException
Specified by:
setValue in interface ListProperty
Parameters:
index - Index of a certain single value of a multi-valued property
value - New value to replace that at the given index
Throws:
StructuralException - if the value is invalid (as in setValue) or the given index is out of range or the Property is immutable
See Also:
ListProperty.setValue(int, java.lang.Object)

getDefaultValue

public java.lang.Object getDefaultValue()
Specified by:
getDefaultValue in interface ListProperty
Returns:
Default value for insertions TODO: remove; use default from NewConfigurableDialog (move to ConfigUtil)
See Also:
ListProperty.getDefaultValue()

Nengo.ca