net.sf.saxon.expr

Class ArithmeticExpression

class ArithmeticExpression extends BinaryExpression

Arithmetic Expression: an expression using one of the operators plus, minus, multiply, div, idiv, mod.
Nested Class Summary
static classArithmeticExpression.DateAndDuration
Inner class to handle addition or subtraction of a Date (or Time, or DateTime) and a Duration
static classArithmeticExpression.DateDifference
Inner class to handle subtraction of a Date (or Time, or DateTime) from another, to return a Duration
static classArithmeticExpression.DurationAddition
Inner class to handle addition and subtraction of two durations
static classArithmeticExpression.DurationDivision
Inner class to handle division of two durations to give a number
static classArithmeticExpression.DurationMultiplication
Inner class to handle multiplication (or division) of a duration by a number
static classArithmeticExpression.NumericArithmetic
Inner class to handle numeric arithmetic expressions
Constructor Summary
ArithmeticExpression(Expression p1, int operator, Expression p2)
Method Summary
ItemevaluateItem(XPathContext context)
Evaluate the expression.
ItemTypegetItemType(TypeHierarchy th)
Determine the data type of the expression, if this is known statically
ExpressiontypeCheck(StaticContext env, ItemType contextItemType)
Type-check the expression statically.

Constructor Detail

ArithmeticExpression

public ArithmeticExpression(Expression p1, int operator, Expression p2)

Method Detail

evaluateItem

public Item evaluateItem(XPathContext context)
Evaluate the expression. We only take this path if the type could not be determined statically.

getItemType

public ItemType getItemType(TypeHierarchy th)
Determine the data type of the expression, if this is known statically

Parameters: th

typeCheck

public Expression typeCheck(StaticContext env, ItemType contextItemType)
Type-check the expression statically. We try to work out which particular arithmetic function to use if the types of operands are known an compile time.