Package mgui.interfaces.variables
Class StringVectorInt
java.lang.Object
mgui.interfaces.AbstractInterfaceObject
mgui.interfaces.variables.VariableInt<java.lang.String>
mgui.interfaces.variables.StringVectorInt
- All Implemented Interfaces:
AttributeObject,InterfaceObject,NamedObject,TreeObject,CleanableObject,XMLObject,IconObject
public class StringVectorInt extends VariableInt<java.lang.String>
Stores an array of
String objects as a variable.- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
-
Nested Class Summary
Nested classes/interfaces inherited from interface mgui.interfaces.xml.XMLObject
XMLObject.XMLEncoding, XMLObject.XMLType -
Field Summary
Fields Modifier and Type Field Description java.util.ArrayList<java.lang.String>elementsFields inherited from class mgui.interfaces.variables.VariableInt
attributes, batch, listeners, updatedFields inherited from class mgui.interfaces.AbstractInterfaceObject
isDestroyed, tree_nodes -
Constructor Summary
Constructors Constructor Description StringVectorInt(java.lang.String name, int n)StringVectorInt(java.lang.String name, java.util.List<java.lang.String> values)StringVectorInt(java.util.List<java.lang.String> values) -
Method Summary
Modifier and Type Method Description java.util.ArrayList<java.lang.String>getAsList()Returns this variable as a single list of values.java.util.ArrayList<java.lang.Integer>getDimensions()intgetN()javax.swing.IcongetObjectIcon()Returns theIconassociated with this object.StringVectorIntgetPart(java.lang.String name, int start, int end)Returns a part of this vector, between and including indicesstartandend.StringVectorIntgetPart(java.lang.String name, java.lang.String part)Parsespartto return a part of this variable.intgetSize()Returns the total size (number of elements) of this variable.java.lang.Class<java.lang.String>getType()Returns aClassobject which is the parameterized type of this variable.java.lang.StringgetValue(int i)protected java.lang.StringgetValue(java.util.List<java.lang.Integer> indices)Returns the value at the given indices; throws an exception if they are out of bounds.booleanisNumeric()Determines whether this variable contains numeric values.booleansetStringValue(java.util.List<java.lang.Integer> indices, java.lang.String value)Sets the value at the given indices as aString; throws an exception if they are out of bounds, this variable is not editable, orvalueis an inappropriate value.booleansetValue(java.util.List<java.lang.Integer> indices, java.lang.String value)Sets the value at the given indices; throws an exception if they are out of bounds, this variable is not editable, orvalueis an inappropriate value.java.lang.StringtoString()Methods inherited from class mgui.interfaces.variables.VariableInt
addListener, fireListeners, getAttribute, getAttributes, getAttributeValue, getDTD, getLocalName, getName, getPart, getShortXML, getValueAt, getXML, getXML, getXMLSchema, handleXMLElementEnd, handleXMLElementStart, handleXMLString, init, isEditable, removeListener, setAttribute, setAttributes, setBatch, setEditable, setName, setTreeNode, writeXML, writeXML, writeXMLMethods inherited from class mgui.interfaces.AbstractInterfaceObject
clean, destroy, getTreeLabel, isDestroyed, issueTreeNode, updateTreeNodesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
elements
public java.util.ArrayList<java.lang.String> elements
-
-
Constructor Details
-
StringVectorInt
public StringVectorInt(java.lang.String name, int n) -
StringVectorInt
public StringVectorInt(java.util.List<java.lang.String> values) -
StringVectorInt
public StringVectorInt(java.lang.String name, java.util.List<java.lang.String> values)
-
-
Method Details
-
getAsList
public java.util.ArrayList<java.lang.String> getAsList()Description copied from class:VariableIntReturns this variable as a single list of values.- Specified by:
getAsListin classVariableInt<java.lang.String>- Returns:
-
getSize
public int getSize()Description copied from class:VariableIntReturns the total size (number of elements) of this variable.- Specified by:
getSizein classVariableInt<java.lang.String>- Returns:
-
getObjectIcon
public javax.swing.Icon getObjectIcon()Description copied from interface:IconObjectReturns theIconassociated with this object.- Specified by:
getObjectIconin interfaceIconObject- Overrides:
getObjectIconin classVariableInt<java.lang.String>- Returns:
-
getValue
- Throws:
VariableException
-
setValue
public boolean setValue(java.util.List<java.lang.Integer> indices, java.lang.String value) throws VariableExceptionDescription copied from class:VariableIntSets the value at the given indices; throws an exception if they are out of bounds, this variable is not editable, orvalueis an inappropriate value.- Specified by:
setValuein classVariableInt<java.lang.String>- Returns:
- object at the given indices
- Throws:
VariableException
-
setStringValue
public boolean setStringValue(java.util.List<java.lang.Integer> indices, java.lang.String value) throws VariableExceptionDescription copied from class:VariableIntSets the value at the given indices as aString; throws an exception if they are out of bounds, this variable is not editable, orvalueis an inappropriate value.- Specified by:
setStringValuein classVariableInt<java.lang.String>- Returns:
- object at the given indices
- Throws:
VariableException
-
getDimensions
public java.util.ArrayList<java.lang.Integer> getDimensions()- Specified by:
getDimensionsin classVariableInt<java.lang.String>
-
getValue
protected java.lang.String getValue(java.util.List<java.lang.Integer> indices) throws VariableExceptionDescription copied from class:VariableIntReturns the value at the given indices; throws an exception if they are out of bounds. If the indices are of a lower dimension than the variable dimension, the returned object is handled by the subclass method. As a general policy, this object should represent the remaining dimensions in some way.- Specified by:
getValuein classVariableInt<java.lang.String>- Returns:
- object at the given indices
- Throws:
VariableException
-
getPart
Returns a part of this vector, between and including indicesstartandend.- Parameters:
name-start-end-- Returns:
-
getPart
Description copied from class:VariableIntParsespartto return a part of this variable. Syntax for n dimensions is: "x_start,y_start,..,n_start:x_start,y_start,..,n_start". E.g., "1,2:20,2". Use asterisk, "*" to indicate last element in a dimension. E.g,, "1,2:*,*".- Specified by:
getPartin classVariableInt<java.lang.String>- Returns:
-
getN
public int getN() -
toString
public java.lang.String toString()- Overrides:
toStringin classVariableInt<java.lang.String>
-
isNumeric
public boolean isNumeric()Description copied from class:VariableIntDetermines whether this variable contains numeric values.- Overrides:
isNumericin classVariableInt<java.lang.String>- Returns:
-
getType
public java.lang.Class<java.lang.String> getType()Description copied from class:VariableIntReturns aClassobject which is the parameterized type of this variable.- Overrides:
getTypein classVariableInt<java.lang.String>- Returns:
-