|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.saxon.expr.Expression
net.sf.saxon.expr.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 |
|---|
EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, EVENT_FEED_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, locationId, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, PUSH_SELECTION, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, WATCH_METHOD |
| 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 |
optimize(ExpressionVisitor visitor,
ExpressionVisitor.ContextItemType contextItemType)
Perform optimisation of an expression and its subexpressions. |
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,
ExpressionVisitor.ContextItemType 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 expression| Method Detail |
|---|
public Expression getCondition()
public DocumentSorter getDocumentSorter()
public Expression typeCheck(ExpressionVisitor visitor,
ExpressionVisitor.ContextItemType contextItemType)
throws XPathException
typeCheck in class Expressionvisitor - 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 Expressionprotected 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 Expressionpublic int getImplementationMethod()
getImplementationMethod in class ExpressionExpression.ITERATE_METHOD or Expression.EVALUATE_METHOD or
Expression.PROCESS_METHODpublic Iterator<Expression> iterateSubExpressions()
iterateSubExpressions in class Expression
public boolean replaceSubExpression(Expression original,
Expression replacement)
replaceSubExpression in class Expressionoriginal - the original subexpressionreplacement - the replacement subexpression
public Expression optimize(ExpressionVisitor visitor,
ExpressionVisitor.ContextItemType contextItemType)
throws XPathException
ExpressionThis method is called after all references to functions and variables have been resolved to the declaration of the function or variable, and after all type checking has been done.
optimize in class Expressionvisitor - 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)protected int computeCardinality()
computeCardinality in class ExpressionStaticProperty.ALLOWS_ZERO_OR_ONE,
StaticProperty.EXACTLY_ONE, StaticProperty.ALLOWS_ONE_OR_MORE,
StaticProperty.ALLOWS_ZERO_OR_MOREpublic Expression copy()
copy in class Expressionpublic void explain(ExpressionPresenter out)
explain in class Expressionout - 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 Expressionth - the type hierarchy cache
public Expression promote(PromotionOffer offer,
Expression parent)
throws XPathException
promote in class Expressionoffer - 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 detected
public SequenceIterator iterate(XPathContext context)
throws XPathException
iterate in class Expressioncontext - 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 | ||||||||