net.sf.saxon.expr

Class AtomicSequenceConverter

Implemented Interfaces:
EvaluableItem, InstructionInfoProvider, SequenceIterable, Serializable, SourceLocator

public final class AtomicSequenceConverter
extends UnaryExpression

An AtomicSequenceConverter is an expression that performs a cast on each member of a supplied sequence

Field Summary

Fields inherited from class net.sf.saxon.expr.UnaryExpression

operand

Fields inherited from class net.sf.saxon.expr.Expression

EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD, locationId, staticProperties

Constructor Summary

AtomicSequenceConverter(Expression sequence, AtomicType requiredItemType)
Constructor

Method Summary

int
computeCardinality()
Determine the static cardinality of the expression
int
computeSpecialProperties()
Determine the special properties of this expression
Expression
copy()
Copy an expression.
boolean
equals(Object other)
Is this expression the same as another expression?
Item
evaluateItem(XPathContext context)
Evaluate as an Item.
void
explain(ExpressionPresenter destination)
Diagnostic print of expression structure.
ItemType
getItemType(TypeHierarchy th)
Determine the data type of the items returned by the expression, if possible
AtomicType
getRequiredPrimitiveType()
Get the required (target) primitive type
SequenceIterator
iterate(XPathContext context)
Iterate over the sequence of values
Expression
simplify(ExpressionVisitor visitor)
Simplify an expression
Expression
typeCheck(ExpressionVisitor visitor, ItemType contextItemType)
Type-check the expression

Methods inherited from class net.sf.saxon.expr.UnaryExpression

computeCardinality, computeSpecialProperties, displayExpressionName, displayOperator, equals, explain, getBaseExpression, getItemType, hashCode, iterateSubExpressions, optimize, promote, replaceSubExpression, simplify, toString, typeCheck

Methods inherited from class net.sf.saxon.expr.Expression

addToPathMap, adoptChildExpression, checkPermittedContents, computeCardinality, computeDependencies, computeSpecialProperties, computeStaticProperties, copy, display, doPromotion, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, explain, explain, findParentOf, getCardinality, getColumnNumber, getConstructType, getContainer, getDependencies, getExecutable, getHostLanguage, getImplementationMethod, getInstructionInfo, getIntrinsicDependencies, getItemType, getLineNumber, getLocationId, getLocationProvider, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, hasLoopingSubexpression, implementsStaticTypeCheck, iterate, iterateEvents, iterateSubExpressions, markTailFunctionCalls, optimize, process, promote, replaceSubExpression, resetLocalStaticProperties, setContainer, setFiltered, setFlattened, setLocationId, simplify, staticTypeCheck, suppressValidation, toString, typeCheck, typeError

Constructor Details

AtomicSequenceConverter

public AtomicSequenceConverter(Expression sequence,
                               AtomicType requiredItemType)
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.
requiredItemType - the item type to which all items in the sequence should be converted, using the rules for "cast as".

Method Details

computeCardinality

public int computeCardinality()
Determine the static cardinality of the expression
Overrides:
computeCardinality in interface UnaryExpression

computeSpecialProperties

public int computeSpecialProperties()
Determine the special properties of this expression
Overrides:
computeSpecialProperties in interface UnaryExpression

copy

public Expression copy()
Copy an expression. This makes a deep copy.
Overrides:
copy in interface Expression
Returns:
the copy of the original expression

equals

public boolean equals(Object other)
Is this expression the same as another expression?
Overrides:
equals in interface UnaryExpression

evaluateItem

public Item evaluateItem(XPathContext context)
            throws XPathException
Evaluate as an Item. This should only be called if the AtomicSequenceConverter has cardinality zero-or-one
Specified by:
evaluateItem in interface EvaluableItem
Overrides:
evaluateItem in interface Expression

explain

public void explain(ExpressionPresenter destination)
Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.
Overrides:
explain in interface UnaryExpression

getItemType

public ItemType getItemType(TypeHierarchy th)
Determine the data type of the items returned by the expression, if possible
Overrides:
getItemType in interface UnaryExpression
Parameters:
th - the type hierarchy cache
Returns:
a value such as Type.STRING, Type.BOOLEAN, Type.NUMBER, Type.NODE, or Type.ITEM (meaning not known in advance)

getRequiredPrimitiveType

public AtomicType getRequiredPrimitiveType()
Get the required (target) primitive type
Returns:
the required primitive type

iterate

public SequenceIterator iterate(XPathContext context)
            throws XPathException
Iterate over the sequence of values
Specified by:
iterate in interface SequenceIterable
Overrides:
iterate in interface Expression

simplify

public Expression simplify(ExpressionVisitor visitor)
            throws XPathException
Simplify an expression
Overrides:
simplify in interface UnaryExpression
Parameters:
visitor - an expression visitor

typeCheck

public Expression typeCheck(ExpressionVisitor visitor,
                            ItemType contextItemType)
            throws XPathException
Type-check the expression
Overrides:
typeCheck in interface UnaryExpression