net.sf.saxon.expr

Class NumericPromoter

public final class NumericPromoter extends UnaryExpression implements MappingFunction

A NumericPromoter performs numeric promotion on each item in a supplied sequence
Constructor Summary
NumericPromoter(Expression sequence, int requiredType)
Constructor
Method Summary
protected StringdisplayOperator(NamePool pool)
Give a string representation of the operator for use in diagnostics
booleanequals(Object other)
Is this expression the same as another expression?
ItemevaluateItem(XPathContext context)
Evaluate as an Item.
ItemTypegetItemType(TypeHierarchy th)
Determine the data type of the items returned by the expression, if possible
SequenceIteratoriterate(XPathContext context)
Iterate over the sequence of values
Objectmap(Item item, XPathContext context)
Implement the mapping function
Expressionoptimize(Optimizer opt, StaticContext env, ItemType contextItemType)
Optimize the expression
Expressionsimplify(StaticContext env)
Simplify an expression
ExpressiontypeCheck(StaticContext env, ItemType contextItemType)
Type-check the expression

Constructor Detail

NumericPromoter

public NumericPromoter(Expression sequence, int requiredType)
Constructor

Parameters: sequence this must be a sequence of atomic values. This is not checked; a ClassCastException will occur if the precondition is not satisfied. requiredType the item type to which all items in the sequence should be converted, using the rules for "cast as".

Method Detail

displayOperator

protected String displayOperator(NamePool pool)
Give a string representation of the operator for use in diagnostics

Returns: the operator, as a string

equals

public boolean equals(Object other)
Is this expression the same as another expression?

evaluateItem

public Item evaluateItem(XPathContext context)
Evaluate as an Item. This should only be called if the expression has cardinality zero-or-one

getItemType

public ItemType getItemType(TypeHierarchy th)
Determine the data type of the items returned by the expression, if possible

Parameters: th

Returns: a value such as Type.STRING, Type.BOOLEAN, Type.NUMBER, Type.NODE, or Type.ITEM (meaning not known in advance)

iterate

public SequenceIterator iterate(XPathContext context)
Iterate over the sequence of values

map

public Object map(Item item, XPathContext context)
Implement the mapping function

optimize

public Expression optimize(Optimizer opt, StaticContext env, ItemType contextItemType)
Optimize the expression

simplify

public Expression simplify(StaticContext env)
Simplify an expression

typeCheck

public Expression typeCheck(StaticContext env, ItemType contextItemType)
Type-check the expression