com.saxonica.update
Class BasicUpdatingExpression

java.lang.Object
  extended by net.sf.saxon.expr.Expression
      extended by com.saxonica.update.BasicUpdatingExpression
All Implemented Interfaces:
Serializable, SourceLocator, LocationProvider, SaxonLocator, EvaluableItem, SequenceIterable, InstructionInfo, Locator
Direct Known Subclasses:
DeleteExpression, InsertExpression, RenameExpression, ReplaceNodeExpression, ReplaceValueExpression

public abstract class BasicUpdatingExpression
extends Expression

A basic updating expression: insert, replace, delete, rename (but not copy)

See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sf.saxon.expr.Expression
EVALUATE_METHOD, EVENT_FEED_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, locationId, PROCESS_METHOD, PUSH_SELECTION, staticProperties, WATCH_METHOD
 
Constructor Summary
BasicUpdatingExpression()
           
 
Method Summary
 int computeCardinality()
          Determine the static cardinality of the expression.
 Item evaluateItem(XPathContext context)
          Evaluate an expression as a single item.
 ItemType getItemType(TypeHierarchy th)
          Determine the data type of the expression, if possible.
 boolean isUpdatingExpression()
          Determine whether this is an updating expression as defined in the XQuery update specification
 SequenceIterator iterate(XPathContext context)
          Return an Iterator to iterate over the values of a sequence.
 void process(XPathContext context)
          Process the instruction, without returning any tail calls
 
Methods inherited from class net.sf.saxon.expr.Expression
addToPathMap, adoptChildExpression, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeSpecialProperties, computeStaticProperties, copy, doPromotion, dynamicError, effectiveBooleanValue, evaluateAsString, evaluatePendingUpdates, explain, explain, getCardinality, getColumnNumber, getColumnNumber, getConstructType, getContainer, getDependencies, getEvaluationMethod, getExecutable, getExpressionName, getHostLanguage, getImplementationMethod, getIntrinsicDependencies, getLineNumber, getLineNumber, getLocationId, getLocationProvider, getObjectName, getProperties, getProperty, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, getSystemId, hasLoopingSubexpression, implementsStaticTypeCheck, isSubtreeExpression, isVacuousExpression, iterateEvents, iterateSameFocusSubExpressions, iterateSubExpressions, markTailFunctionCalls, optimize, promote, replaceSubExpression, resetLocalStaticProperties, setContainer, setEvaluationMethod, setFiltered, setFlattened, setLocationId, simplify, staticTypeCheck, suppressValidation, toString, typeCheck, typeError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicUpdatingExpression

public BasicUpdatingExpression()
Method Detail

isUpdatingExpression

public final boolean isUpdatingExpression()
Determine whether this is an updating expression as defined in the XQuery update specification

Overrides:
isUpdatingExpression in class Expression
Returns:
true if this is an updating expression (which it is)

computeCardinality

public int computeCardinality()
Determine the static cardinality of the expression. This establishes how many items there will be in the result of the expression, at compile time (i.e., without actually evaluating the result.

Specified by:
computeCardinality in class Expression
Returns:
one of the values Cardinality.ONE_OR_MORE, Cardinality.ZERO_OR_MORE, Cardinality.EXACTLY_ONE, Cardinality.ZERO_OR_ONE, Cardinality.EMPTY. This default implementation returns ZERO_OR_MORE (which effectively gives no information).

getItemType

public ItemType getItemType(TypeHierarchy th)
Determine the data type of the expression, if possible. All expression return sequences, in general; this method determines the type of the items within the sequence, assuming that (a) this is known in advance, and (b) it is the same for all items in the sequence.

This method should always return a result, though it may be the best approximation that is available at the time.

Specified by:
getItemType in class Expression
Parameters:
th - the type hierarchy cache
Returns:
a value such as Type.STRING, Type.BOOLEAN, Type.NUMBER, Type.NODE, or Type.ITEM (meaning not known at compile time)

evaluateItem

public Item evaluateItem(XPathContext context)
                  throws XPathException
Evaluate an expression as a single item. This always returns either a single Item or null (denoting the empty sequence). No conversion is done. This method should not be used unless the static type of the expression is a subtype of "item" or "item?": that is, it should not be called if the expression may return a sequence. There is no guarantee that this condition will be detected.

Specified by:
evaluateItem in interface EvaluableItem
Overrides:
evaluateItem in class Expression
Parameters:
context - The context in which the expression is to be evaluated
Returns:
the node or atomic value that results from evaluating the expression; or null to indicate that the result is an empty sequence
Throws:
XPathException - if any dynamic error occurs evaluating the expression

iterate

public SequenceIterator iterate(XPathContext context)
                         throws XPathException
Return an Iterator to iterate over the values of a sequence. The value of every expression can be regarded as a sequence, so this method is supported for all expressions. This default implementation handles iteration for expressions that return singleton values: for non-singleton expressions, the subclass must provide its own implementation.

Specified by:
iterate in interface SequenceIterable
Overrides:
iterate in class Expression
Parameters:
context - supplies the context for evaluation
Returns:
a SequenceIterator that can be used to iterate over the result of the expression
Throws:
XPathException - if any dynamic error occurs evaluating the expression

process

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

Overrides:
process in class Expression
Parameters:
context - The dynamic context, giving access to the current node, the current variables, etc.
Throws:
XPathException


Copyright (c) 2004-2010 Saxonica Limited. All rights reserved.