Class MatrixValueParser

java.lang.Object
math.matrix.expressParser.MatrixValueParser

public class MatrixValueParser extends 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.
  • Field Details

    • valid

      private boolean valid
    • values

      private String values
    • scan

      private ArrayList<String> scan
    • size

      private Dimension size
      The size of the matrix
  • Constructor Details

    • MatrixValueParser

      public MatrixValueParser()
    • MatrixValueParser

      public MatrixValueParser(String values)
      Parameters:
      values - A matrix value string e.g [2,4,5:3,9.939,45.2:1,4,2:]
  • Method Details

    • scanner

      public void scanner() throws MatrixFormatException
      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(String values)
    • getValues

      public String getValues()
    • setValid

      public void setValid(boolean valid)
    • isValid

      public boolean isValid()
    • getSize

      public Dimension getSize()
    • setScan

      public void setScan(ArrayList<String> scan)
    • getScan

      public ArrayList<String> getScan()
    • getMatrix

      public Matrix getMatrix() throws NullPointerException
      Returns:
      a Matrix object from the scanned values.
      Throws:
      NullPointerException
    • getPrecisionMatrix

      public PrecisionMatrix getPrecisionMatrix() throws NullPointerException
      Returns:
      a PrecisionMatrix object from the scanned values.
      Throws:
      NullPointerException