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.Matrix
matrix
Fields inherited from class mgui.interfaces.variables.VariableInt
attributes, batch, listeners, updated
Fields 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 columncol
as aVectorInt
object.VectorInt<MguiDouble>
getColumn(java.lang.String name, int col)
Returns columncol
as aVectorInt
object.java.util.ArrayList<java.lang.Integer>
getDimensions()
Jama.Matrix
getJamaMatrix()
Returns the Jama matrix for this object.int
getM()
Returns the row dimension, Mint
getN()
Returns the column dimension, Njavax.swing.Icon
getObjectIcon()
Returns theIcon
associated with this object.MatrixInt
getPart(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.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.MatrixInt
getPart(java.lang.String name, java.lang.String part)
Parsespart
to return a sub-matrix.VectorInt<MguiDouble>
getRow(int row)
Returns rowrow
as aVectorInt
object.VectorInt<MguiDouble>
getRow(java.lang.String name, int row)
Returns rowrow
as aVectorInt
object.int
getSize()
Returns the total size (number of elements) of this variable.java.lang.Class<MguiDouble>
getType()
Returns aClass
object which is the parameterized type of this variable.MguiDouble
getValue(int i, int j)
protected MguiDouble
getValue(java.util.List<java.lang.Integer> indices)
Returns the value at the given indices; throws an exception if they are out of bounds.boolean
isNumeric()
Determines whether this variable contains numeric values.boolean
setStringValue(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, orvalue
is an inappropriate value.boolean
setValue(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, orvalue
is an inappropriate value.java.lang.String
toString()
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, writeXML
Methods inherited from class mgui.interfaces.AbstractInterfaceObject
clean, destroy, getTreeLabel, isDestroyed, issueTreeNode, updateTreeNodes
Methods 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:VariableInt
Determines whether this variable contains numeric values.- Overrides:
isNumeric
in classVariableInt<MguiDouble>
- Returns:
-
getAsList
Description copied from class:VariableInt
Returns this variable as a single list of values.- Specified by:
getAsList
in classVariableInt<MguiDouble>
- Returns:
-
getSize
public int getSize()Description copied from class:VariableInt
Returns the total size (number of elements) of this variable.- Specified by:
getSize
in classVariableInt<MguiDouble>
- Returns:
-
getType
Description copied from class:VariableInt
Returns aClass
object which is the parameterized type of this variable.- Overrides:
getType
in classVariableInt<MguiDouble>
- Returns:
-
getObjectIcon
public javax.swing.Icon getObjectIcon()Description copied from interface:IconObject
Returns theIcon
associated with this object.- Specified by:
getObjectIcon
in interfaceIconObject
- Overrides:
getObjectIcon
in classVariableInt<MguiDouble>
- Returns:
-
setValue
public boolean setValue(java.util.List<java.lang.Integer> indices, MguiDouble value) throws VariableExceptionDescription copied from class:VariableInt
Sets the value at the given indices; throws an exception if they are out of bounds, this variable is not editable, orvalue
is an inappropriate value.- Specified by:
setValue
in 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:VariableInt
Sets the value at the given indices as aString
; throws an exception if they are out of bounds, this variable is not editable, orvalue
is an inappropriate value.- Specified by:
setStringValue
in classVariableInt<MguiDouble>
- Returns:
- object at the given indices
- Throws:
VariableException
-
getValue
- Throws:
VariableException
-
getDimensions
public java.util.ArrayList<java.lang.Integer> getDimensions()- Specified by:
getDimensions
in classVariableInt<MguiDouble>
-
getValue
Description copied from class:VariableInt
Returns 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:
getValue
in 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
Parsespart
to 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:
getPart
in classVariableInt<MguiDouble>
- Parameters:
name
-part
-- Returns:
-
getRow
Returns rowrow
as aVectorInt
object.- Parameters:
row
-- Returns:
-
getRow
Returns rowrow
as aVectorInt
object.- Parameters:
row
-- Returns:
-
getColumn
Returns columncol
as aVectorInt
object.- Parameters:
col
-- Returns:
-
getColumn
Returns columncol
as aVectorInt
object.- 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:
toString
in classVariableInt<MguiDouble>
-