public final class FirstItemExpression extends UnaryExpression
operand
locationId, staticProperties
EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD
Constructor and Description |
---|
FirstItemExpression(Expression base)
Constructor
|
Modifier and Type | Method and Description |
---|---|
int |
computeCardinality()
Get the static cardinality
|
java.lang.String |
displayOperator(Configuration config)
Diagnostic print of expression structure
|
Item |
evaluateItem(XPathContext context)
Evaluate the expression
|
Expression |
optimize(Optimizer opt,
StaticContext env,
ItemType contextItemType)
Perform optimisation of an expression and its subexpressions.
|
Expression |
promote(PromotionOffer offer)
Promote this expression if possible
|
computeSpecialProperties, display, equals, getBaseExpression, getItemType, hashCode, iterateSubExpressions, replaceSubExpression, simplify, typeCheck
adoptChildExpression, checkPermittedContents, computeDependencies, computeStaticProperties, doPromotion, dynamicError, effectiveBooleanValue, evaluateAsString, getCardinality, getColumnNumber, getConstructType, getDependencies, getExecutable, getHostLanguage, getImplementationMethod, getInstructionInfo, getIntrinsicDependencies, getLineNumber, getLocationId, getLocationProvider, getParentExpression, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, hasBadParentPointer, iterate, markTailFunctionCalls, process, resetStaticProperties, setLocationId, setParentExpression, setParentExpression, suppressValidation, typeError
public FirstItemExpression(Expression base)
base
- A sequence expression denoting sequence whose first item is to be returnedpublic Expression optimize(Optimizer opt, StaticContext env, ItemType contextItemType) throws XPathException
This 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 interface Expression
optimize
in class UnaryExpression
opt
- the optimizer in use. This provides access to supporting functions; it also allows
different optimization strategies to be used in different circumstances.env
- the static context of the expressioncontextItemType
- 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
StaticError
- if an error is discovered during this phase
(typically a type error)XPathException
public Expression promote(PromotionOffer offer) throws XPathException
promote
in interface Expression
promote
in class UnaryExpression
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 expressionXPathException
- if any error is detectedpublic int computeCardinality()
computeCardinality
in class UnaryExpression
public Item evaluateItem(XPathContext context) throws XPathException
evaluateItem
in interface Expression
evaluateItem
in class ComputedExpression
context
- The context in which the expression is to be evaluatedXPathException
- if any dynamic error occurs evaluating the
expressionpublic java.lang.String displayOperator(Configuration config)
displayOperator
in class UnaryExpression
config
-