Package mgui.interfaces.variables
Class MatrixInt
java.lang.Object
- All Implemented Interfaces:
AttributeObject,InterfaceObject,NamedObject,TreeObject,CleanableObject,XMLObject,IconObject
public class MatrixInt extends VariableInt<MguiDouble>
Interface for a 2D matrix, represented internally as a Jama matrix of doubles.
- 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 protected Jama.MatrixmatrixFields 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 MatrixInt(java.lang.String name, int m, int n)MatrixInt(java.lang.String name, Jama.Matrix m)MatrixInt(java.util.ArrayList<java.util.ArrayList<MguiNumber>> values) -
Method Summary
Modifier and Type Method Description java.util.ArrayList<MguiDouble>getAsList()Returns this variable as a single list of values.VectorInt<MguiDouble>getColumn(int col)Returns columncolas aVectorIntobject.VectorInt<MguiDouble>getColumn(java.lang.String name, int col)Returns columncolas aVectorIntobject.java.util.ArrayList<java.lang.Integer>getDimensions()Jama.MatrixgetJamaMatrix()Returns the Jama matrix for this object.intgetM()Returns the row dimension, MintgetN()Returns the column dimension, Njavax.swing.IcongetObjectIcon()Returns theIconassociated with this object.MatrixIntgetPart(int row_start, int row_end, int col_start, int col_end)Returns a sub-matrix of this matrix, defined by start and end indices.MatrixIntgetPart(java.lang.String name, int row_start, int col_start, int row_end, int col_end)Returns a sub-matrix of this matrix, defined by start and end indices, with the given name.MatrixIntgetPart(java.lang.String name, java.lang.String part)Parsespartto return a sub-matrix.VectorInt<MguiDouble>getRow(int row)Returns rowrowas aVectorIntobject.VectorInt<MguiDouble>getRow(java.lang.String name, int row)Returns rowrowas aVectorIntobject.intgetSize()Returns the total size (number of elements) of this variable.java.lang.Class<MguiDouble>getType()Returns aClassobject which is the parameterized type of this variable.MguiDoublegetValue(int i, int j)protected MguiDoublegetValue(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, MguiDouble 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
-
matrix
protected Jama.Matrix matrix
-
-
Constructor Details
-
MatrixInt
public MatrixInt(java.lang.String name, int m, int n) -
MatrixInt
public MatrixInt(java.lang.String name, Jama.Matrix m) -
MatrixInt
-
-
Method Details
-
isNumeric
public boolean isNumeric()Description copied from class:VariableIntDetermines whether this variable contains numeric values.- Overrides:
isNumericin classVariableInt<MguiDouble>- Returns:
-
getAsList
Description copied from class:VariableIntReturns this variable as a single list of values.- Specified by:
getAsListin classVariableInt<MguiDouble>- Returns:
-
getSize
public int getSize()Description copied from class:VariableIntReturns the total size (number of elements) of this variable.- Specified by:
getSizein classVariableInt<MguiDouble>- Returns:
-
getType
Description copied from class:VariableIntReturns aClassobject which is the parameterized type of this variable.- Overrides:
getTypein classVariableInt<MguiDouble>- Returns:
-
getObjectIcon
public javax.swing.Icon getObjectIcon()Description copied from interface:IconObjectReturns theIconassociated with this object.- Specified by:
getObjectIconin interfaceIconObject- Overrides:
getObjectIconin classVariableInt<MguiDouble>- Returns:
-
setValue
public boolean setValue(java.util.List<java.lang.Integer> indices, MguiDouble 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<MguiDouble>- 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<MguiDouble>- Returns:
- object at the given indices
- Throws:
VariableException
-
getValue
- Throws:
VariableException
-
getDimensions
public java.util.ArrayList<java.lang.Integer> getDimensions()- Specified by:
getDimensionsin classVariableInt<MguiDouble>
-
getValue
Description 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<MguiDouble>- Returns:
- object at the given indices
- Throws:
VariableException
-
getPart
Returns a sub-matrix of this matrix, defined by start and end indices.- Parameters:
row_start-col_start-row_end-col_end-- Returns:
-
getPart
public MatrixInt getPart(java.lang.String name, int row_start, int col_start, int row_end, int col_end)Returns a sub-matrix of this matrix, defined by start and end indices, with the given name.- Parameters:
name-row_start-col_start-row_end-col_end-- Returns:
-
getPart
Parsespartto return a sub-matrix. Syntax is: "row_start,col_start:row_end,col_end". E.g., "1,2:20,2". Use an asterisk "*" to indicate the last row and column, respectively (actually replaces the value with M-1, N-1). E.g,, "0,0:*,*" is the entire matrix.- Specified by:
getPartin classVariableInt<MguiDouble>- Parameters:
name-part-- Returns:
-
getRow
Returns rowrowas aVectorIntobject.- Parameters:
row-- Returns:
-
getRow
Returns rowrowas aVectorIntobject.- Parameters:
row-- Returns:
-
getColumn
Returns columncolas aVectorIntobject.- Parameters:
col-- Returns:
-
getColumn
Returns columncolas aVectorIntobject.- Parameters:
row-- Returns:
-
getM
public int getM()Returns the row dimension, M- Returns:
-
getN
public int getN()Returns the column dimension, N- Returns:
-
getJamaMatrix
public Jama.Matrix getJamaMatrix()Returns the Jama matrix for this object.- Returns:
-
toString
public java.lang.String toString()- Overrides:
toStringin classVariableInt<MguiDouble>
-