JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.util.formulae
Class MathMatrix

java.lang.Object
  |
  +--com.klg.jclass.util.formulae.MathValue
        |
        +--com.klg.jclass.util.formulae.MathMatrix
All Implemented Interfaces:
Cloneable, Expression, Result

public class MathMatrix
extends MathValue

The class of matrices (we almost undoubtedly do not ever need to go beyond this point, since nobody in their right mind would ever try to do tensor math in a spreadsheet). NOTE: We probably do not need to implement this for the first version but I include it here as a potential consideration for future development


Field Summary
protected  int columns
          Rows and Columns define the number of entries in the matrix
protected  Number[][] realValues
          The values are stored in an array
protected  int rows
          Rows and Columns define the number of entries in the matrix
 
Fields inherited from class com.klg.jclass.util.formulae.MathValue
dataFormat
 
Constructor Summary
MathMatrix()
          Create a default matrix (all entries initialised to 0)
MathMatrix(double[][] values)
          Create a matrix from an array of double values
MathMatrix(int[][] values)
          Create a matrix from an array of integer values
MathMatrix(Number[][] values)
          Create a matrix from an array of Numbers
 
Method Summary
 com.klg.jclass.util.formulae.Expression getValueAt(int row, int column)
          Retrieve the value at a particular index in the matrix
 Number[][] matrixValue()
          Get the contents of this MathValue as a matrix of Numbers
 Number numberValue()
          Get the contents of this MathValue as a Number
 void setValueAt(int row, int column, Number value)
          Set the value at a particular index in the matrix
 String toString()
          Return a string representation of this value
 Number[] vectorValue()
          Get the contents of this MathValue as a vector of Numbers
 
Methods inherited from class com.klg.jclass.util.formulae.MathValue
clone, evaluate, getDataFormat, setDataFormat
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

realValues

protected Number[][] realValues
The values are stored in an array


rows

protected int rows
Rows and Columns define the number of entries in the matrix


columns

protected int columns
Rows and Columns define the number of entries in the matrix

Constructor Detail

MathMatrix

public MathMatrix()
Create a default matrix (all entries initialised to 0)


MathMatrix

public MathMatrix(double[][] values)
Create a matrix from an array of double values


MathMatrix

public MathMatrix(int[][] values)
Create a matrix from an array of integer values


MathMatrix

public MathMatrix(Number[][] values)
Create a matrix from an array of Numbers

Method Detail

numberValue

public Number numberValue()
Get the contents of this MathValue as a Number

Specified by:
numberValue in class MathValue
Returns:
A Number which is the contents of this MathValue

vectorValue

public Number[] vectorValue()
Get the contents of this MathValue as a vector of Numbers

Specified by:
vectorValue in class MathValue
Returns:
A vector of Numbers which is the contents of this MathValue

matrixValue

public Number[][] matrixValue()
Get the contents of this MathValue as a matrix of Numbers

Specified by:
matrixValue in class MathValue
Returns:
A matrix of Numbers which is the contents of this MathValue

getValueAt

public com.klg.jclass.util.formulae.Expression getValueAt(int row,
                                                          int column)
Retrieve the value at a particular index in the matrix

Returns:
The MathValue stored at a given location

setValueAt

public void setValueAt(int row,
                       int column,
                       Number value)
Set the value at a particular index in the matrix

Parameters:
value - The MathValue to store at the given location

toString

public String toString()
Return a string representation of this value

Overrides:
toString in class Object
Returns:
A string containing this value

Copyright © 2004 Quest Software Inc..
All rights reserved.