Class LinearSystemParser

java.lang.Object
math.matrix.equationParser.LinearSystemParser

public class LinearSystemParser
extends java.lang.Object
Author:
JIBOYE Oluwagbemiro Olaoluwa
  • Constructor Summary

    Constructors 
    Constructor Description
    LinearSystemParser​(java.lang.String systemOfEquations)  
  • Method Summary

    Modifier and Type Method Description
    void appendOneToStartOfFreeVariables()
    When the situation x+2y+z=9; is met, this method will convert it into 1.0x+2y+z=9;
    void buildMatrix()
    Builds the Matrix object that will contain the executable generated by this LinearSystemParser object.
    void countVariablesAndValidateTheNumberOfEqualsAndSemiColons()
    Counts the number of unknowns in the system and compares it with the number of equations in the system.
    void doAritmetic()
    Handles split variable arithmetic in + and - alone.
    int getDimension()  
    java.lang.String getEndOfLine()  
    Matrix getEquationMatrix()  
    java.util.ArrayList<java.lang.String> getScanner()  
    java.lang.String getSystemOfEquations()  
    java.util.ArrayList<java.lang.String> getUnknowns()  
    java.lang.String interpretedSystem()
    This builds the ideal form of the system with 0 coefficients assigned to parts of the system where an unknown is missing...e.g in 2x+3y+4z=9; 7x+5z=8; 6y=9; This system will eventually be converted into 2x+3y+4z=9; 7x+0y+5z=8; 0x+6y+0z=9;
    boolean isValid()  
    static void main​(java.lang.String[] args)  
    void setDimension​(int dimension)  
    void setEndOfLine​(java.lang.String endOfLine)  
    void setScanner​(java.util.ArrayList<java.lang.String> scanner)  
    void setSystemOfEquations​(java.lang.String systemOfEquations)  
    void setValid​(boolean valid)  
    void validateNumbers()
    Checks the left and right of a number to see if the appropriate items are the ones there.
    void validateOperators()
    Checks the left and right of an operator to see if the appropriate items are the ones there.
    void validateVars()
    Checks the left and right of all variables to see if the appropriate items are the ones there.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • setEndOfLine

      public void setEndOfLine​(java.lang.String endOfLine)
    • getEndOfLine

      public java.lang.String getEndOfLine()
    • getUnknowns

      public java.util.ArrayList<java.lang.String> getUnknowns()
    • getEquationMatrix

      public Matrix getEquationMatrix()
    • setValid

      public void setValid​(boolean valid)
    • isValid

      public boolean isValid()
    • setDimension

      public void setDimension​(int dimension)
    • getDimension

      public int getDimension()
    • setSystemOfEquations

      public void setSystemOfEquations​(java.lang.String systemOfEquations)
    • getSystemOfEquations

      public java.lang.String getSystemOfEquations()
    • setScanner

      public void setScanner​(java.util.ArrayList<java.lang.String> scanner)
    • getScanner

      public java.util.ArrayList<java.lang.String> getScanner()
    • appendOneToStartOfFreeVariables

      public void appendOneToStartOfFreeVariables()
      When the situation x+2y+z=9; is met, this method will convert it into 1.0x+2y+z=9;
    • countVariablesAndValidateTheNumberOfEqualsAndSemiColons

      public void countVariablesAndValidateTheNumberOfEqualsAndSemiColons()
      Counts the number of unknowns in the system and compares it with the number of equations in the system. They must be equal and so it carries out this validation also. This method also fills the ArrayList object that records the unknowns in the system with one copy of each unknown found in the system.
    • validateVars

      public void validateVars()
      Checks the left and right of all variables to see if the appropriate items are the ones there. It is a syntax error if an invalid item is found there
    • validateNumbers

      public void validateNumbers()
      Checks the left and right of a number to see if the appropriate items are the ones there. It is a syntax error if an invalid item is found there
    • validateOperators

      public void validateOperators()
      Checks the left and right of an operator to see if the appropriate items are the ones there. It is a syntax error if an invalid item is found there
    • doAritmetic

      public void doAritmetic()
      Handles split variable arithmetic in + and - alone. e.g 2x+3y+4z+7x-9=3x-8y+2; 4z-2x-9=3x-8y+2z+9; -9x+5y+x=9x-2y+2; is converted into 6x+11y+4z=11; -5x+8y+2z=18; -17x+7y=2;
    • buildMatrix

      public void buildMatrix()
      Builds the Matrix object that will contain the executable generated by this LinearSystemParser object.
    • interpretedSystem

      public java.lang.String interpretedSystem()
      This builds the ideal form of the system with 0 coefficients assigned to parts of the system where an unknown is missing...e.g in 2x+3y+4z=9; 7x+5z=8; 6y=9; This system will eventually be converted into 2x+3y+4z=9; 7x+0y+5z=8; 0x+6y+0z=9;
    • main

      public static void main​(java.lang.String[] args)