net.sf.saxon.expr

Class ItemChecker

public final class ItemChecker extends UnaryExpression implements MappingExpression

A ItemChecker implements the item type checking of "treat as": that is, it returns the supplied sequence, checking that all its items are of the correct type
Constructor Summary
ItemChecker(Expression sequence, ItemType itemType, RoleLocator role)
Constructor
Method Summary
Expressioncopy()
Copy an expression.
booleanequals(Object other)
Is this expression the same as another expression?
ItemevaluateItem(XPathContext context)
Evaluate as an Item.
voidexplain(ExpressionPresenter out)
Diagnostic print of expression structure.
intgetImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().
ItemTypegetItemType(TypeHierarchy th)
Determine the data type of the items returned by the expression
SequenceIteratorgetMappingIterator(SequenceIterator base, XPathContext context)
ItemTypegetRequiredType()
Get the required type
RoleLocatorgetRoleLocator()
Get the RoleLocator (used to construct error messages)
SequenceIteratoriterate(XPathContext context)
Iterate over the sequence of values
voidprocess(XPathContext context)
Process the instruction, without returning any tail calls
Expressionsimplify(ExpressionVisitor visitor)
Simplify an expression
ExpressiontypeCheck(ExpressionVisitor visitor, ItemType contextItemType)
Type-check the expression

Constructor Detail

ItemChecker

public ItemChecker(Expression sequence, ItemType itemType, RoleLocator role)
Constructor

Parameters: sequence the expression whose value we are checking itemType the required type of the items in the sequence role information used in constructing an error message

Method Detail

copy

public Expression copy()
Copy an expression. This makes a deep copy.

Returns: the copy of the original expression

equals

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

evaluateItem

public Item evaluateItem(XPathContext context)
Evaluate as an Item.

explain

public void explain(ExpressionPresenter out)
Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.

getImplementationMethod

public int getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). This method indicates which of these methods is provided. This implementation provides both iterate() and process() methods natively.

getItemType

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

Parameters: th the type hierarchy cache

getMappingIterator

public SequenceIterator getMappingIterator(SequenceIterator base, XPathContext context)

getRequiredType

public ItemType getRequiredType()
Get the required type

Returns: the required type of the items in the sequence

getRoleLocator

public RoleLocator getRoleLocator()
Get the RoleLocator (used to construct error messages)

Returns: the RoleLocator

iterate

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

process

public void process(XPathContext context)
Process the instruction, without returning any tail calls

Parameters: context The dynamic context, giving access to the current node, the current variables, etc.

simplify

public Expression simplify(ExpressionVisitor visitor)
Simplify an expression

Parameters: visitor an expression visitor

typeCheck

public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType)
Type-check the expression