Package net.sf.saxon.expr
Class UntypedSequenceConverter
- java.lang.Object
-
- net.sf.saxon.expr.Expression
-
- net.sf.saxon.expr.UnaryExpression
-
- net.sf.saxon.expr.AtomicSequenceConverter
-
- net.sf.saxon.expr.UntypedSequenceConverter
-
- All Implemented Interfaces:
ExportAgent,Locatable,IdentityComparable,Traceable
public final class UntypedSequenceConverter extends AtomicSequenceConverter
An UntypedSequenceConverter is an expression that performs a cast on each member of a supplied sequence that is an untypedAtomic value, while leaving other items unchanged
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classUntypedSequenceConverter.UntypedConverterA Converter that converts untyped atomic values to the required type, while leaving other values unchanged-
Nested classes/interfaces inherited from class net.sf.saxon.expr.AtomicSequenceConverter
AtomicSequenceConverter.AtomicSequenceMappingFunction, AtomicSequenceConverter.ToStringMappingFunction
-
-
Field Summary
-
Fields inherited from class net.sf.saxon.expr.AtomicSequenceConverter
converter, requiredItemType, TO_STRING_MAPPER
-
Fields inherited from class net.sf.saxon.expr.Expression
EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, MAX_COST, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, UPDATE_METHOD, WATCH_METHOD
-
-
Constructor Summary
Constructors Constructor Description UntypedSequenceConverter(Expression sequence, PlainType requiredItemType)Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcomputeCardinality()Determine the static cardinality of the expressionintcomputeHashCode()get HashCode for comparing two expressions.intcomputeSpecialProperties()Determine the special properties of this expressionExpressioncopy(RebindingMap rebindings)Copy an expression.protected java.lang.StringdisplayOperator(Configuration config)Give a string representation of the operator for use in diagnosticsbooleanequals(java.lang.Object other)Is this expression the same as another expression?voidexport(ExpressionPresenter destination)Diagnostic print of expression structure.java.lang.StringgetExpressionName()Get a name identifying the kind of expression, in terms meaningful to a user.ItemTypegetItemType()Determine the data type of the items returned by the expression, if possiblestatic UntypedSequenceConvertermakeUntypedSequenceConverter(Configuration config, Expression operand, PlainType requiredItemType)Create an AtomicSequenceConverter that converts all untypedAtomic values in the input sequence to a specified target type, while leaving items other than untypedAtomic unchangedstatic UntypedSequenceConvertermakeUntypedSequenceRejector(Configuration config, Expression operand, PlainType requiredItemType)java.lang.StringtoShortString()Produce a short string identifying the expression for use in error messagesExpressiontypeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo)Type-check the expression-
Methods inherited from class net.sf.saxon.expr.AtomicSequenceConverter
allocateConverter, allocateConverter, allocateConverterStatically, evaluateItem, getConverter, getConverterDynamically, getImplementationMethod, getOperandRole, getRequiredItemType, getRoleDiagnostic, getStreamerName, iterate, optimize, setConverter, setRoleDiagnostic, simplify
-
Methods inherited from class net.sf.saxon.expr.UnaryExpression
emitExtraAttributes, getBaseExpression, getOperand, operands, setBaseExpression, toString
-
Methods inherited from class net.sf.saxon.expr.Expression
addToPathMap, adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, dynamicError, effectiveBooleanValue, evaluateAsString, evaluatePendingUpdates, explain, getCardinality, getConfiguration, getCost, getDependencies, getEvaluationMethod, getExtraProperty, getIntegerBounds, getInterpretedExpression, getIntrinsicDependencies, getLocalRetainedStaticContext, getLocation, getNetCost, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getStaticUType, getTracingTag, hasCompatibleStaticContext, hashCode, hasSpecialProperty, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isEqual, isIdentical, isInstruction, isLiftable, isMultiThreaded, isStaticPropertiesKnown, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, prepareForStreaming, process, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setFlattened, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplifyChildren, staticTypeCheck, suppressValidation, toPattern, typeCheckChildren, typeError, unordered, verifyParentPointers
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.trace.Traceable
gatherProperties
-
-
-
-
Constructor Detail
-
UntypedSequenceConverter
public UntypedSequenceConverter(Expression sequence, PlainType requiredItemType)
Constructor- Parameters:
sequence- this must be a sequence of atomic values. This is not checked; a ClassCastException will occur if the precondition is not satisfied.requiredItemType- the item type to which all items in the sequence should be converted, using the rules for "cast as".
-
-
Method Detail
-
makeUntypedSequenceConverter
public static UntypedSequenceConverter makeUntypedSequenceConverter(Configuration config, Expression operand, PlainType requiredItemType) throws XPathException
Create an AtomicSequenceConverter that converts all untypedAtomic values in the input sequence to a specified target type, while leaving items other than untypedAtomic unchanged- Parameters:
config- the Saxon configurationoperand- the expression that delivers the input sequencerequiredItemType- the type to which untypedAtomic values should be cast, which must either be an atomic type or a "plain" union type- Returns:
- an AtomicSequenceConverter that performs the required conversion
- Throws:
XPathException- if an error occurs, for example if the target type is namespace-sensitive
-
makeUntypedSequenceRejector
public static UntypedSequenceConverter makeUntypedSequenceRejector(Configuration config, Expression operand, PlainType requiredItemType)
-
typeCheck
public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException
Description copied from class:AtomicSequenceConverterType-check the expression- Overrides:
typeCheckin classAtomicSequenceConverter- Parameters:
visitor- an expression visitorcontextInfo- Information available statically about the context item: whether it is (possibly) absent; its static type; its streaming posture.- Returns:
- the original expression, rewritten to perform necessary run-time type checks, and to perform other type-related optimizations
- Throws:
XPathException- if an error is discovered during this phase (typically a type error)
-
computeSpecialProperties
public int computeSpecialProperties()
Determine the special properties of this expression- Overrides:
computeSpecialPropertiesin classAtomicSequenceConverter- Returns:
StaticProperty.NO_NODES_NEWLY_CREATED.
-
copy
public Expression copy(RebindingMap rebindings)
Copy an expression. This makes a deep copy.- Overrides:
copyin classAtomicSequenceConverter- Parameters:
rebindings-- Returns:
- the copy of the original expression
-
getItemType
public ItemType getItemType()
Determine the data type of the items returned by the expression, if possible- Overrides:
getItemTypein classAtomicSequenceConverter- Returns:
- a value such as Type.STRING, Type.BOOLEAN, Type.NUMBER, Type.NODE, or Type.ITEM (meaning not known in advance)
-
computeCardinality
public int computeCardinality()
Determine the static cardinality of the expression- Overrides:
computeCardinalityin classAtomicSequenceConverter- Returns:
- the computed cardinality, as one of the values
StaticProperty.ALLOWS_ZERO_OR_ONE,StaticProperty.EXACTLY_ONE,StaticProperty.ALLOWS_ONE_OR_MORE,StaticProperty.ALLOWS_ZERO_OR_MORE. May also returnStaticProperty.ALLOWS_ZEROif the result is known to be an empty sequence, orStaticProperty.ALLOWS_MANYif if is known to return a sequence of length two or more.
-
equals
public boolean equals(java.lang.Object other)
Is this expression the same as another expression?- Overrides:
equalsin classAtomicSequenceConverter- Parameters:
other- the other operand; the result is false if this is not an Expression- Returns:
- true if the other operand is an expression and if it can be determined that the two expressions are equivalent, in the sense that they will always return the same result.
-
computeHashCode
public int computeHashCode()
get HashCode for comparing two expressions.- Overrides:
computeHashCodein classAtomicSequenceConverter- Returns:
- a computed hash code
-
displayOperator
protected java.lang.String displayOperator(Configuration config)
Description copied from class:UnaryExpressionGive a string representation of the operator for use in diagnostics- Overrides:
displayOperatorin classAtomicSequenceConverter- Parameters:
config- the Saxon configuration- Returns:
- the operator, as a string
-
getExpressionName
public java.lang.String getExpressionName()
Get a name identifying the kind of expression, in terms meaningful to a user.- Overrides:
getExpressionNamein classAtomicSequenceConverter- Returns:
- a name identifying the kind of expression, in terms meaningful to a user. The name will always be in the form of a lexical XML QName, and should match the name used in explain() output displaying the expression.
-
toShortString
public java.lang.String toShortString()
Description copied from class:ExpressionProduce a short string identifying the expression for use in error messages- Overrides:
toShortStringin classUnaryExpression- Returns:
- a short string, sufficient to identify the expression
-
export
public void export(ExpressionPresenter destination) throws XPathException
Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.- Specified by:
exportin interfaceExportAgent- Overrides:
exportin classAtomicSequenceConverter- Parameters:
destination- the expression presenter used to display the structure- Throws:
XPathException- if the export fails, for example if an expression is found that won't work in the target environment.
-
-