|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.saxon.expr.Expression net.sf.saxon.sort.ConditionalSorter
public class ConditionalSorter
An expression that sorts an underlying sequence into document order if some condition is true, or that returns the sequence "as is" (knowing that it doesn't need sorting) if the condition is false.
Field Summary |
---|
Fields inherited from class net.sf.saxon.expr.Expression |
---|
EVALUATE_METHOD, ITERATE_METHOD, locationId, PROCESS_METHOD, staticProperties |
Constructor Summary | |
---|---|
ConditionalSorter(Expression condition,
DocumentSorter sorter)
Create a conditional document sorter |
Method Summary | |
---|---|
protected int |
computeCardinality()
Compute the static cardinality of this expression |
protected int |
computeSpecialProperties()
Compute the special properties of this expression. |
Expression |
copy()
Copy an expression. |
void |
explain(ExpressionPresenter out)
Diagnostic print of expression structure. |
int |
getCardinality()
Determine the static cardinality of the expression. |
Expression |
getCondition()
Get the condition under which the nodes need to be sorted |
DocumentSorter |
getDocumentSorter()
Get the document sorter, which sorts the nodes if the condition is true |
int |
getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). |
ItemType |
getItemType(TypeHierarchy th)
Determine the data type of the expression, if possible. |
SequenceIterator |
iterate(XPathContext context)
Return an Iterator to iterate over the values of a sequence. |
Iterator<Expression> |
iterateSubExpressions()
Get the immediate sub-expressions of this expression. |
Expression |
promote(PromotionOffer offer,
Expression parent)
Offer promotion for this subexpression. |
boolean |
replaceSubExpression(Expression original,
Expression replacement)
Replace one subexpression by a replacement subexpression |
Expression |
typeCheck(ExpressionVisitor visitor,
ItemType contextItemType)
Perform type checking of an expression and its subexpressions. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ConditionalSorter(Expression condition, DocumentSorter sorter)
condition
- the conditional expressionsorter
- the sorting expressionMethod Detail |
---|
public Expression getCondition()
public DocumentSorter getDocumentSorter()
public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException
typeCheck
in class Expression
visitor
- an expression visitorcontextItemType
- the static type of "." at the point where this expression is invoked.
The parameter is set to null if it is known statically that the context item will be undefined.
If the type of the context item is not known statically, the argument is set to
Type.ITEM_TYPE
XPathException
- if an error is discovered during this phase
(typically a type error)public int getCardinality()
getCardinality
in class Expression
protected int computeSpecialProperties()
StaticProperty
. The "special" properties are properties
other than cardinality and dependencies, and most of them relate to properties of node sequences, for
example whether the nodes are in document order.
computeSpecialProperties
in class Expression
public int getImplementationMethod()
getImplementationMethod
in class Expression
Expression.ITERATE_METHOD
or Expression.EVALUATE_METHOD
or
Expression.PROCESS_METHOD
public Iterator<Expression> iterateSubExpressions()
iterateSubExpressions
in class Expression
public boolean replaceSubExpression(Expression original, Expression replacement)
replaceSubExpression
in class Expression
original
- the original subexpressionreplacement
- the replacement subexpression
protected int computeCardinality()
computeCardinality
in class Expression
StaticProperty.ALLOWS_ZERO_OR_ONE
,
StaticProperty.EXACTLY_ONE
, StaticProperty.ALLOWS_ONE_OR_MORE
,
StaticProperty.ALLOWS_ZERO_OR_MORE
public Expression copy()
copy
in class Expression
public void explain(ExpressionPresenter out)
explain
in class Expression
out
- the expression presenter used to display the structurepublic ItemType getItemType(TypeHierarchy th)
This method should always return a result, though it may be the best approximation that is available at the time.
getItemType
in class Expression
th
- the type hierarchy cache
public Expression promote(PromotionOffer offer, Expression parent) throws XPathException
promote
in class Expression
offer
- details of the offer, for example the offer to move
expressions that don't depend on the context to an outer level in
the containing expressionparent
-
XPathException
- if any error is detectedpublic SequenceIterator iterate(XPathContext context) throws XPathException
iterate
in interface SequenceIterable
iterate
in class Expression
context
- supplies the context for evaluation
XPathException
- if any dynamic error occurs evaluating the
expression
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |