Package parser
Class UnaryPreOperator
- java.lang.Object
-
- parser.Operator
-
- parser.UnaryPreOperator
-
- All Implemented Interfaces:
Validatable
public final class UnaryPreOperator extends Operator implements Validatable
Models a post-operand Operator object e.g the trigonometric,logarithmic,exponential e.t.c. operators.- Author:
- GBEMIRO
-
-
Field Summary
-
Fields inherited from class parser.Operator
AND, ASSIGN, AT, CLOSE_CIRC_BRAC, CLOSE_SQUARE_BRAC, COLON, COMBINATION, COMMA, CONST, CUBE, CUBE_ROOT, DIVIDE, EN_DASH, EQUALS, EXIT, FACTORIAL, GREATER_OR_EQUALS, GREATER_THAN, INVERSE, LESS_OR_EQUALS, LESS_THAN, MINUS, MULTIPLY, OPEN_CIRC_BRAC, OPEN_SQUARE_BRAC, operators, OR, PERMUTATION, PLUS, POWER, REMAINDER, ROOT, SEMI_COLON, SPACE, SQUARE, STORE
-
-
Constructor Summary
Constructors Constructor Description UnaryPreOperator(java.lang.String name, int index, java.util.ArrayList<java.lang.String> scan)Creates a new UnaryPreOperator object
-
Method Summary
Modifier and Type Method Description static voidassignCompoundTokens(MathExpression function)PrecedencegetPrecedence()booleanvalidate(java.util.ArrayList<java.lang.String> scan)-
Methods inherited from class parser.Operator
getName, getPrecedence, isAssignmentOperator, isAtOperator, isBinaryOperator, isBracket, isClosingBrace, isClosingBracket, isColon, isComma, isConstantStoreCommand, isCube, isCubeRoot, isEqualsOperator, isExitCommand, isFactorial, isInverse, isLogicOperator, isMulOrDiv, isMulOrDivOrRemOrPermOrCombOrPow, isOpeningBrace, isOpeningBracket, isOperatorString, isPermOrComb, isPlusOrMinus, isPower, isRemainder, isSemiColon, isSquare, isSquareRoot, isStoreCommand, isUnaryPostOperator, isUnaryPreOperator, orderCompoundTokens, setName, validateAll
-
-
-
-
Method Detail
-
getPrecedence
public Precedence getPrecedence()
- Returns:
- the precedence of this operator
-
validate
public boolean validate(java.util.ArrayList<java.lang.String> scan)
- Specified by:
validatein interfaceValidatable- Parameters:
scan- the ArrayList object that this UnaryPreOperator object exists in. validates the grammatical usage of this operator (by leaving the correctFunction attribute of the function object un-modified) if the usage of this operator in its immediate environment i.e to its left and right is correct.- Returns:
- true if the grammatical usage of this token with repect to its 2 immediate neighbouring tokens to the left and to the right is correct.
-
assignCompoundTokens
public static void assignCompoundTokens(MathExpression function)
- Parameters:
function- the MathExpression object that contains the power operator
-
-