Class AbstractOperator
- java.lang.Object
-
- com.igormaznitsa.jcp.expression.operators.AbstractOperator
-
- All Implemented Interfaces:
ExpressionItem
- Direct Known Subclasses:
OperatorADD,OperatorAND,OperatorDIV,OperatorEQU,OperatorGREAT,OperatorGREATEQU,OperatorLESS,OperatorLESSEQU,OperatorMOD,OperatorMUL,OperatorNOT,OperatorNOTEQU,OperatorOR,OperatorSUB,OperatorXOR
public abstract class AbstractOperator extends java.lang.Object implements ExpressionItem
The class is the base for all operator handlers
-
-
Field Summary
Fields Modifier and Type Field Description static AbstractOperator[]ALL_OPERATORSThe array contains all operators allowed by the preprocessorstatic java.lang.StringEXECUTION_PREFIXThe constant is the prefix for executing methods of operators
-
Constructor Summary
Constructors Constructor Description AbstractOperator()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static <E extends AbstractOperator>
EfindForClass(java.lang.Class<E> operatorClass)Find an operator handler for its classabstract intgetArity()Get the operator arityExpressionItemTypegetExpressionItemType()Get the expression item typeabstract java.lang.StringgetKeyword()Get the operator keywordabstract java.lang.StringgetReference()Get the operator reference to be shown for a help information requestjava.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.igormaznitsa.jcp.expression.ExpressionItem
getExpressionItemPriority
-
-
-
-
Field Detail
-
EXECUTION_PREFIX
public static final java.lang.String EXECUTION_PREFIX
The constant is the prefix for executing methods of operators- See Also:
- Constant Field Values
-
ALL_OPERATORS
public static final AbstractOperator[] ALL_OPERATORS
The array contains all operators allowed by the preprocessor
-
-
Method Detail
-
findForClass
public static <E extends AbstractOperator> E findForClass(java.lang.Class<E> operatorClass)
Find an operator handler for its class- Type Parameters:
E- the handler class extends AbstractOperator- Parameters:
operatorClass- the class to be used for search, must not be null- Returns:
- an instance of the handler or null if there is not any such one
-
getExpressionItemType
public ExpressionItemType getExpressionItemType()
Get the expression item type- Specified by:
getExpressionItemTypein interfaceExpressionItem- Returns:
- for operators it is always ExpressionItemType.OPERATOR
-
getArity
public abstract int getArity()
Get the operator arity- Returns:
- the operator arity (1 or 2)
-
getKeyword
public abstract java.lang.String getKeyword()
Get the operator keyword- Returns:
- the operator keyword, must not be null
-
getReference
public abstract java.lang.String getReference()
Get the operator reference to be shown for a help information request- Returns:
- the operator reference as a String, must not be null
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-