Package com.saxonica.ee.bytecode
Class ArithmeticCompiler
- java.lang.Object
-
- com.saxonica.ee.bytecode.ExpressionCompiler
-
- com.saxonica.ee.bytecode.ToItemCompiler
-
- com.saxonica.ee.bytecode.ArithmeticCompiler
-
public class ArithmeticCompiler extends ToItemCompiler
Generate bytecode for a call to the ArithmeticExpression
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Map<java.lang.Class<? extends Calculator>,java.lang.Class<? extends CalculatorCompiler>>
map
-
Constructor Summary
Constructors Constructor Description ArithmeticCompiler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
compileToItem(CompilerService compiler, Expression expression)
Generate bytecode to evaluate the ArithmeticExpression Precondition: none.void
compileToPrimitive(CompilerService compiler, Expression expression, java.lang.Class<?> requiredClass, OnEmpty onEmpty)
Generate bytecode to evaluate the expression leaving a plain Java value on the stack.static java.lang.Class<? extends CalculatorCompiler>
map(Calculator calc)
-
Methods inherited from class com.saxonica.ee.bytecode.ToItemCompiler
compileToBoolean, compileToIterator, compileToPush, treatAsEmptyIfFirstArgumentIsEmpty
-
Methods inherited from class com.saxonica.ee.bytecode.ExpressionCompiler
allocateStatic, compileItemFromInt, generateMethod, handleEmptyStringResult, printStackTop, verify, visitAnnotation, visitLineNumber
-
-
-
-
Field Detail
-
map
public static java.util.Map<java.lang.Class<? extends Calculator>,java.lang.Class<? extends CalculatorCompiler>> map
-
-
Method Detail
-
compileToItem
public void compileToItem(CompilerService compiler, Expression expression) throws CannotCompileException
Generate bytecode to evaluate the ArithmeticExpression Precondition: none. Postcondition: the stack contains an item representing the result of the expression- Specified by:
compileToItem
in classExpressionCompiler
- Parameters:
compiler
- the compiler serviceexpression
- the expression to be compiled- Throws:
CannotCompileException
- if the expression cannot be compiled to bytecode
-
compileToPrimitive
public void compileToPrimitive(CompilerService compiler, Expression expression, java.lang.Class<?> requiredClass, OnEmpty onEmpty) throws CannotCompileException
Generate bytecode to evaluate the expression leaving a plain Java value on the stack. The static type of the expression must be such that the value is known to be representable by a value of the specified class; the cardinality must be either exactly-one or zero-or-one.- Overrides:
compileToPrimitive
in classExpressionCompiler
- Parameters:
compiler
- the compiler serviceexpression
- the expression to be compiledrequiredClass
- the class of the Java value that is to be left on the stack if the generated code exits normally. This must be one of Integer.TYPE, Double.TYPE, Float.TYPE, BigDecimal.class, CharSequence.class.onEmpty
- a label to which control will be transferred (with nothing on the stack) if the result of the- Throws:
CannotCompileException
- if the expression cannot be compiled to bytecode
-
map
public static java.lang.Class<? extends CalculatorCompiler> map(Calculator calc)
-
-