Package parser

Class Operator

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String AND  
      static java.lang.String ASSIGN  
      static java.lang.String AT  
      static java.lang.String CLOSE_CIRC_BRAC  
      static java.lang.String CLOSE_SQUARE_BRAC  
      static java.lang.String COLON  
      static java.lang.String COMBINATION  
      static java.lang.String COMMA  
      static java.lang.String CONST  
      static java.lang.String CUBE  
      static java.lang.String CUBE_ROOT  
      static java.lang.String DIVIDE  
      static java.lang.String EN_DASH  
      static java.lang.String EQUALS  
      static java.lang.String EXIT  
      static java.lang.String FACTORIAL  
      static java.lang.String GREATER_OR_EQUALS  
      static java.lang.String GREATER_THAN  
      static java.lang.String INVERSE  
      static java.lang.String LESS_OR_EQUALS  
      static java.lang.String LESS_THAN  
      static java.lang.String MINUS  
      static java.lang.String MULTIPLY  
      protected java.lang.String name
      The name of the operator object
      static java.lang.String OPEN_CIRC_BRAC  
      static java.lang.String OPEN_SQUARE_BRAC  
      static java.lang.String[] operators
      The instruction set of the parser of this software.
      static java.lang.String OR  
      static java.lang.String PERMUTATION  
      static java.lang.String PLUS  
      static java.lang.String POWER  
      static java.lang.String REMAINDER  
      static java.lang.String ROOT  
      static java.lang.String SEMI_COLON  
      static java.lang.String SPACE  
      static java.lang.String SQUARE  
      static java.lang.String STORE  
    • Constructor Summary

      Constructors 
      Constructor Description
      Operator​(java.lang.String name)  
    • Constructor Detail

      • Operator

        public Operator​(java.lang.String name)
        Parameters:
        name - creates a new form of a valid mathronian Operator
    • Method Detail

      • setName

        public void setName​(java.lang.String name)
        Parameters:
        name - set the name of the Operator object
      • getName

        public java.lang.String getName()
        Returns:
        the name of the Operator object
      • isOperatorString

        public static boolean isOperatorString​(java.lang.String op)
        Parameters:
        op - The string to check.
        Returns:
        true if the operator is a valid mathronian operator
      • isExitCommand

        public static boolean isExitCommand​(java.lang.String op)
        Parameters:
        op - the String object in consideration
        Returns:
        true if the String object contains a exit command
      • isSemiColon

        public boolean isSemiColon​(java.lang.String op)
      • isAtOperator

        public static boolean isAtOperator​(java.lang.String op)
      • isStoreCommand

        public static boolean isStoreCommand​(java.lang.String op)
        Parameters:
        op - the String object in consideration
        Returns:
        true if the String object contains a STORE command
      • isConstantStoreCommand

        public static boolean isConstantStoreCommand​(java.lang.String op)
        Parameters:
        op - the String object in consideration
        Returns:
        true if the String object contains a constant storage command
      • isOpeningBrace

        public static boolean isOpeningBrace​(java.lang.String op)
        Parameters:
        op - the String object in consideration
        Returns:
        true if the String object represents a [ character
      • isClosingBrace

        public static boolean isClosingBrace​(java.lang.String op)
        Parameters:
        op - the String object in consideration
        Returns:
        true if the String object represents a [ character
      • isColon

        public static boolean isColon​(java.lang.String op)
        Parameters:
        op - the String object in consideration
        Returns:
        true if the String object represents a : character This operator is used to mark the end-point of Variable initialization e.g [A=2,AA=3,acy=8.838383]:3A+6AA-8acy This instructs the parser to initialize the variables A, AA, acy with the values given and then evaluate the expression
      • isLogicOperator

        public static boolean isLogicOperator​(java.lang.String op)
        Parameters:
        op - the String to check
        Returns:
        true if the operator is a logic operator the logic operators defined here are ==,<e;,>e;,<,>,|,&
      • isEqualsOperator

        public static boolean isEqualsOperator​(java.lang.String op)
        Parameters:
        op - the String to check
        Returns:
        true if the operator is the EQUALS operator
      • isAssignmentOperator

        public static boolean isAssignmentOperator​(java.lang.String op)
        Parameters:
        op - the String to check
        Returns:
        true if the operator is the ASSIGN operator it means that we assign or store the value of the RHS in the LHS and so the LHS must represent a valid variable
      • isBinaryOperator

        public static boolean isBinaryOperator​(java.lang.String op)
        Parameters:
        op - the String to check
        Returns:
        true if the operator is an operator that functions in between 2 numbers or variables i.e,+,-,*,/,^,%,Č,Р
      • isPlusOrMinus

        public static boolean isPlusOrMinus​(java.lang.String op)
        Parameters:
        op - the String to check
        Returns:
        true if the operator is the + operator or is the - operator the form is log-¹(num,base)
      • isMulOrDiv

        public static boolean isMulOrDiv​(java.lang.String op)
        Parameters:
        op - the String to check
        Returns:
        true if the operator is the / operator or is the * operator the form is log-¹(num,base)
      • isPermOrComb

        public static boolean isPermOrComb​(java.lang.String op)
        Parameters:
        op - the String to check
        Returns:
        true if the operator is the permutation operator or is the combination operator the form is log-¹(num,base)
      • isMulOrDivOrRemOrPermOrCombOrPow

        public static boolean isMulOrDivOrRemOrPermOrCombOrPow​(java.lang.String op)
        Parameters:
        op - the String to check
        Returns:
        true if the operator is the + operator or is the - operator the form is log-¹(num,base)
      • isRemainder

        public static boolean isRemainder​(java.lang.String op)
        Parameters:
        op - the String to check
        Returns:
        true if the operator is the REMAINDER operator
      • isPower

        public static boolean isPower​(java.lang.String op)
        Parameters:
        op - the String to check
        Returns:
        true if the operator is the POWER operator
      • isBracket

        public static boolean isBracket​(java.lang.String op)
        Parameters:
        op - the String to check
        Returns:
        true if the operator is the OPEN_CIRC_BRAC or the CLOSE_CIRC_BRAC operator
      • isOpeningBracket

        public static boolean isOpeningBracket​(java.lang.String op)
        Parameters:
        op - the String to check
        Returns:
        true if the operator is the OPEN_CIRC_BRAC operator
      • isClosingBracket

        public static boolean isClosingBracket​(java.lang.String op)
        Parameters:
        op - the String to check
        Returns:
        true if the operator is the CLOSE_CIRC_BRAC operator
      • isFactorial

        public static boolean isFactorial​(java.lang.String op)
        Parameters:
        op - the String to check
        Returns:
        true if the operator is the FACTORIAL operator
      • isInverse

        public static boolean isInverse​(java.lang.String op)
        Parameters:
        op - the String to check
        Returns:
        true if the operator is the INVERSE operator
      • isSquareRoot

        public static boolean isSquareRoot​(java.lang.String op)
        Parameters:
        op - the String to check
        Returns:
        true if the operator is the ROOT operator
      • isCubeRoot

        public static boolean isCubeRoot​(java.lang.String op)
        Parameters:
        op - the String to check
        Returns:
        true if the operator is the "³√" operator
      • isSquare

        public static boolean isSquare​(java.lang.String op)
        Parameters:
        op - the String to check
        Returns:
        true if the operator is the SQUARE operator
      • isCube

        public static boolean isCube​(java.lang.String op)
        Parameters:
        op - the String to check
        Returns:
        true if the operator is the CUBE operator
      • isUnaryPreOperator

        public static boolean isUnaryPreOperator​(java.lang.String op)
        Parameters:
        op - the String to check
        Returns:
        true if the operator is a pre-number operator e.g the trig operators,exponential operators,logarithmic operators(not to any base)
      • isUnaryPostOperator

        public static boolean isUnaryPostOperator​(java.lang.String op)
        Parameters:
        op - the String to check
        Returns:
        true if the operator is a post number operator e.g the inverse operator,the factorial,the square and the cube
      • isComma

        public static boolean isComma​(java.lang.String op)
        Parameters:
        op - the String to check
        Returns:
        true if the operator is the comma(,) operator
      • getPrecedence

        public static Precedence getPrecedence​(java.lang.String name)
        The precedence of the operators
        Parameters:
        name - the name of the Operator object
        Returns:
        the Operator's Precedence attribute
      • validateAll

        public static boolean validateAll​(java.util.ArrayList<java.lang.String> scan)
        Parameters:
        scan - An ArrayList object containing a scanned function.
        Returns:
        true if validated