Package org.basex.query.expr
Enum Class Calc
- All Implemented Interfaces:
Serializable,Comparable<Calc>,java.lang.constant.Constable
Calculation.
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionabstract ItemPerforms the calculation.abstract Calcinvert()Inverts the operator.static TypeReturns the numeric type with the highest precedence.abstract Exproptimize(Expr expr1, Expr expr2, InputInfo info, CompileContext cc) Optimizes the expressions.toString()abstract TypeReturns the result type of this calculation.static CalcReturns the enum constant of this class with the specified name.static Calc[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
PLUS
Addition. -
MINUS
Subtraction. -
MULT
Multiplication. -
DIV
Division. -
IDIV
Integer division. -
MOD
Modulo.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
eval
Performs the calculation.- Parameters:
item1- first itemitem2- second itemii- input info- Returns:
- result type
- Throws:
QueryException- query exception
-
optimize
public abstract Expr optimize(Expr expr1, Expr expr2, InputInfo info, CompileContext cc) throws QueryException Optimizes the expressions.- Parameters:
expr1- first expressionexpr2- second expressioninfo- input infocc- compilation context- Returns:
- result expression, or
nullif expression cannot be optimized - Throws:
QueryException- query exception
-
type
Returns the result type of this calculation.- Parameters:
type1- first item typetype2- second item type- Returns:
- result expression, or
nullif expression cannot be optimized
-
invert
Inverts the operator.- Returns:
- inverted operator or
null
-
numType
Returns the numeric type with the highest precedence.- Parameters:
type1- first item typetype2- second item type- Returns:
- type
-
toString
-