Package math.matrix.expressParser
Class MatrixValueParser
java.lang.Object
math.matrix.expressParser.MatrixValueParser
public class MatrixValueParser
extends java.lang.Object
Objects of this class extract a matrix from an input expression of the
format:
[num1,num2,...:num_i,num_i+1,....:num_j,num_j+1...: ] e.g [2,3,4:4,1,2:...]
The colons represent the end of one row of values and the beginning of
another.
- Author:
- JIBOYE Oluwagbemiro Olaoluwa
-
Constructor Summary
Constructors Constructor Description MatrixValueParser()MatrixValueParser(java.lang.String values) -
Method Summary
Modifier and Type Method Description MatrixgetMatrix()PrecisionMatrixgetPrecisionMatrix()java.util.ArrayList<java.lang.String>getScan()DimensiongetSize()java.lang.StringgetValues()booleanisValid()voidscanner()Scans a matrix value string into tokens, e.g [2,4,5:3,9.939,45.2:1,4,2] and produces an output containing the numbers and the colons in the ArrayList attribute scan.voidsetScan(java.util.ArrayList<java.lang.String> scan)voidsetValid(boolean valid)voidsetValues(java.lang.String values)
-
Constructor Details
-
MatrixValueParser
public MatrixValueParser() -
MatrixValueParser
public MatrixValueParser(java.lang.String values)- Parameters:
values- A matrix value string e.g [2,4,5:3,9.939,45.2:1,4,2:]
-
-
Method Details
-
scanner
Scans a matrix value string into tokens, e.g [2,4,5:3,9.939,45.2:1,4,2] and produces an output containing the numbers and the colons in the ArrayList attribute scan. Method getMatrix then extracts the matrix from scan.- Throws:
MatrixFormatException- if the format of the input does not conform to that of a matrix.
-
setValues
public void setValues(java.lang.String values) -
getValues
public java.lang.String getValues() -
setValid
public void setValid(boolean valid) -
isValid
public boolean isValid() -
getSize
-
setScan
public void setScan(java.util.ArrayList<java.lang.String> scan) -
getScan
public java.util.ArrayList<java.lang.String> getScan() -
getMatrix
- Returns:
- a Matrix object from the scanned values.
- Throws:
java.lang.NullPointerException
-
getPrecisionMatrix
- Returns:
- a PrecisionMatrix object from the scanned values.
- Throws:
java.lang.NullPointerException
-