Package com.udojava.evalex
Class AbstractLazyOperator
- java.lang.Object
-
- com.udojava.evalex.AbstractLazyOperator
-
- All Implemented Interfaces:
LazyOperator
- Direct Known Subclasses:
AbstractOperator
public abstract class AbstractLazyOperator extends java.lang.Object implements LazyOperator
Abstract implementation of an operator.
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanbooleanOperatorOperator is boolean.protected booleanleftAssocOperator is left associative.protected java.lang.StringoperThis operators name (pattern).protected intprecedenceOperators precedence.protected booleanunaryOperatorOperator is unary, i.e.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractLazyOperator(java.lang.String oper, int precedence, boolean leftAssoc)Creates a new operator.protectedAbstractLazyOperator(java.lang.String oper, int precedence, boolean leftAssoc, boolean booleanOperator)Creates a new boolean operator.protectedAbstractLazyOperator(java.lang.String oper, int precedence, boolean leftAssoc, boolean booleanOperator, boolean unaryOperator)Creates a new unary operator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetOper()Gets the String that is used to denote the operator in the expression.intgetPrecedence()Gets the precedence value of this operator.booleanisBooleanOperator()Gets whether this operator evaluates to a boolean expression.booleanisLeftAssoc()Gets whether this operator is left associative (true) or if this operator is right associative (false).booleanisUnaryOperator()Gets whether this operator is unary or not.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.udojava.evalex.LazyOperator
eval
-
-
-
-
Field Detail
-
oper
protected java.lang.String oper
This operators name (pattern).
-
precedence
protected int precedence
Operators precedence.
-
leftAssoc
protected boolean leftAssoc
Operator is left associative.
-
booleanOperator
protected boolean booleanOperator
Operator is boolean.
-
unaryOperator
protected boolean unaryOperator
Operator is unary, i.e. 1 or 2 operands expected for this operator.
-
-
Constructor Detail
-
AbstractLazyOperator
protected AbstractLazyOperator(java.lang.String oper, int precedence, boolean leftAssoc, boolean booleanOperator, boolean unaryOperator)Creates a new unary operator. This constructor allows the use of postfix unary operators.- Parameters:
oper- The operator name (pattern).precedence- The operators precedence.leftAssoc-trueif the operator is left associative, elsefalse.booleanOperator- Whether this operator is boolean.unaryOperator-trueif the expected number of operands is 1,falseif the expected number of operands is 2.
-
AbstractLazyOperator
protected AbstractLazyOperator(java.lang.String oper, int precedence, boolean leftAssoc, boolean booleanOperator)Creates a new boolean operator.- Parameters:
oper- The operator name (pattern).precedence- The operators precedence.leftAssoc-trueif the operator is left associative, elsefalse.booleanOperator- Whether this operator is boolean.
-
AbstractLazyOperator
protected AbstractLazyOperator(java.lang.String oper, int precedence, boolean leftAssoc)Creates a new operator.- Parameters:
oper- The operator name (pattern).precedence- The operators precedence.leftAssoc-trueif the operator is left associative, elsefalse.
-
-
Method Detail
-
getOper
public java.lang.String getOper()
Description copied from interface:LazyOperatorGets the String that is used to denote the operator in the expression.- Specified by:
getOperin interfaceLazyOperator- Returns:
- The String that is used to denote the operator in the expression.
-
getPrecedence
public int getPrecedence()
Description copied from interface:LazyOperatorGets the precedence value of this operator.- Specified by:
getPrecedencein interfaceLazyOperator- Returns:
- the precedence value of this operator.
-
isLeftAssoc
public boolean isLeftAssoc()
Description copied from interface:LazyOperatorGets whether this operator is left associative (true) or if this operator is right associative (false).- Specified by:
isLeftAssocin interfaceLazyOperator- Returns:
trueif this operator is left associative.
-
isBooleanOperator
public boolean isBooleanOperator()
Description copied from interface:LazyOperatorGets whether this operator evaluates to a boolean expression.- Specified by:
isBooleanOperatorin interfaceLazyOperator- Returns:
trueif this operator evaluates to a boolean expression.
-
isUnaryOperator
public boolean isUnaryOperator()
Description copied from interface:LazyOperatorGets whether this operator is unary or not.- Specified by:
isUnaryOperatorin interfaceLazyOperator- Returns:
trueif the number of operands for this operator is 1, orfalseif the number of operands is 2.
-
-