net.sf.saxon.expr

Class SimpleMappingExpression

public final class SimpleMappingExpression extends ComputedExpression implements MappingFunction

A simple mapping expression is an expression A/B where B has a static type that is an atomic type. For example, * / name().
Constructor Summary
SimpleMappingExpression(Expression start, Expression step, boolean isHybrid)
Constructor
Method Summary
intcomputeCardinality()
Determine the static cardinality of the expression
intcomputeDependencies()
Determine which aspects of the context the expression depends on.
intcomputeSpecialProperties()
Get the static properties of this expression (other than its type).
voiddisplay(int level, NamePool pool, PrintStream out)
Diagnostic print of expression structure
booleanequals(Object other)
Is this expression the same as another expression?
ItemTypegetItemType(TypeHierarchy th)
Determine the data type of the items returned by this exprssion
ExpressiongetStartExpression()
Get the start expression (the left-hand operand)
ExpressiongetStepExpression()
Get the step expression (the right-hand operand)
inthashCode()
get HashCode for comparing two expressions
SequenceIteratoriterate(XPathContext context)
Iterate the path-expression in a given context
IteratoriterateSubExpressions()
Get the immediate subexpressions of this expression
Objectmap(Item item, XPathContext context)
Mapping function, from a node returned by the start iteration, to a sequence returned by the child.
Expressionoptimize(Optimizer opt, StaticContext env, ItemType contextItemType)
Expressionpromote(PromotionOffer offer)
Promote this expression if possible
Expressionsimplify(StaticContext env)
Simplify an expression
ExpressiontypeCheck(StaticContext env, ItemType contextItemType)
Type-check the expression

Constructor Detail

SimpleMappingExpression

public SimpleMappingExpression(Expression start, Expression step, boolean isHybrid)
Constructor

Parameters: start A node-set expression denoting the absolute or relative set of nodes from which the navigation path should start. step The step to be followed from each node in the start expression to yield a new node-set isHybrid if true, indicates that we don't know statically whether the step expression will return nodes or atomic values. If false, we know it will return atomic values.

Method Detail

computeCardinality

public int computeCardinality()
Determine the static cardinality of the expression

computeDependencies

public int computeDependencies()
Determine which aspects of the context the expression depends on. The result is a bitwise-or'ed value composed from constants such as XPathContext.VARIABLES and XPathContext.CURRENT_NODE

computeSpecialProperties

public int computeSpecialProperties()
Get the static properties of this expression (other than its type). The result is bit-signficant. These properties are used for optimizations. In general, if property bit is set, it is true, but if it is unset, the value is unknown.

display

public void display(int level, NamePool pool, PrintStream out)
Diagnostic print of expression structure

equals

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

getItemType

public final ItemType getItemType(TypeHierarchy th)
Determine the data type of the items returned by this exprssion

Parameters: th

Returns: the type of the step

getStartExpression

public Expression getStartExpression()
Get the start expression (the left-hand operand)

getStepExpression

public Expression getStepExpression()
Get the step expression (the right-hand operand)

hashCode

public int hashCode()
get HashCode for comparing two expressions

iterate

public SequenceIterator iterate(XPathContext context)
Iterate the path-expression in a given context

Parameters: context the evaluation context

iterateSubExpressions

public Iterator iterateSubExpressions()
Get the immediate subexpressions of this expression

map

public Object map(Item item, XPathContext context)
Mapping function, from a node returned by the start iteration, to a sequence returned by the child.

optimize

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

promote

public Expression promote(PromotionOffer offer)
Promote this expression if possible

simplify

public Expression simplify(StaticContext env)
Simplify an expression

Returns: the simplified expression

typeCheck

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