com.saxonica.extra
Class StringMirrorExpression

java.lang.Object
  extended bynet.sf.saxon.expr.ComputedExpression
      extended bynet.sf.saxon.expr.UnaryExpression
          extended bycom.saxonica.extra.StringMirrorExpression
All Implemented Interfaces:
Container, Expression, InstructionInfoProvider, java.io.Serializable, javax.xml.transform.SourceLocator

public final class StringMirrorExpression
extends UnaryExpression

A StringMirrorExpression is used internally when indexing values that may be typed or untypedAtomic. Given a sequence of atomic values, it returns a sequence consisting of all the original atomic values, plus copies of those values that aren't strings or untyped atomic, converted to untyped atomic. For example, if the input sequence is (3,4,"+",5) then the output is (3,"3",4,"4","+",5,"5").

It is thus equivalent to:

for $in in $sequence return ($in, xdt:untypedAtomic($in)[not($in instanceof xs:string or $in instanceof xdt:untypedAtomic)])

See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sf.saxon.expr.UnaryExpression
operand
 
Fields inherited from class net.sf.saxon.expr.ComputedExpression
locationId, staticProperties
 
Fields inherited from interface net.sf.saxon.expr.Expression
EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD
 
Constructor Summary
StringMirrorExpression(Expression base)
           
 
Method Summary
 int computeCardinality()
          Get the static cardinality of the expression
 int computeSpecialProperties()
          Determine the special properties of this expression
protected  java.lang.String displayOperator(NamePool pool)
          Give a string representation of the operator for use in diagnostics
 ItemType getItemType(TypeHierarchy th)
          Get the static type of the expression
 SequenceIterator iterate(XPathContext context)
          Return an Iterator to iterate over the values of a sequence.
 
Methods inherited from class net.sf.saxon.expr.UnaryExpression
display, equals, getBaseExpression, hashCode, iterateSubExpressions, optimize, promote, simplify, typeCheck
 
Methods inherited from class net.sf.saxon.expr.ComputedExpression
adoptChildExpression, checkPermittedContents, computeDependencies, computeStaticProperties, doPromotion, dynamicError, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, getCardinality, getColumnNumber, getConstructType, getDependencies, getExecutable, getHostLanguage, getImplementationMethod, getInstructionInfo, getIntrinsicDependencies, getLineNumber, getLocationId, getLocationProvider, getParentExpression, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, hasBadParentPointer, markTailFunctionCalls, process, resetStaticProperties, setLocationId, setParentExpression, suppressValidation, typeError, typeError
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringMirrorExpression

public StringMirrorExpression(Expression base)
Method Detail

computeCardinality

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

Overrides:
computeCardinality in class UnaryExpression

getItemType

public ItemType getItemType(TypeHierarchy th)
Get the static type of the expression

Specified by:
getItemType in interface Expression
Overrides:
getItemType in class UnaryExpression
Parameters:
th -
Returns:
the item type of the items in the result sequence, insofar as this is known statically.

computeSpecialProperties

public int computeSpecialProperties()
Determine the special properties of this expression

Overrides:
computeSpecialProperties in class UnaryExpression
Returns:
StaticProperty.NON_CREATIVE.

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 Expression
Overrides:
iterate in class ComputedExpression
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

displayOperator

protected java.lang.String displayOperator(NamePool pool)
Give a string representation of the operator for use in diagnostics

Specified by:
displayOperator in class UnaryExpression
Returns:
the operator, as a string