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
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 ClassesModifier and TypeClassDescriptionstatic class
A Converter that converts untyped atomic values to the required type, while leaving other values unchangedstatic class
Elaborator for an UntypedSequenceConverterNested classes/interfaces inherited from class net.sf.saxon.expr.AtomicSequenceConverter
AtomicSequenceConverter.AtomicSequenceConverterElaborator, 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
ConstructorsConstructorDescriptionUntypedSequenceConverter
(Expression sequence, PlainType requiredItemType) Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected int
Determine the static cardinality of the expressionprotected int
get HashCode for comparing two expressions.protected int
Determine the special properties of this expressioncopy
(RebindingMap rebindings) Copy an expression.protected String
displayOperator
(Configuration config) Give a string representation of the operator for use in diagnosticsboolean
Is this expression the same as another expression?void
export
(ExpressionPresenter destination) Diagnostic print of expression structure.Make an elaborator for this expressionGet a name identifying the kind of expression, in terms meaningful to a user.Determine the data type of the items returned by the expression, if possiblestatic UntypedSequenceConverter
makeUntypedSequenceConverter
(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 UntypedSequenceConverter
makeUntypedSequenceRejector
(Configuration config, Expression operand, PlainType requiredItemType) Produce a short string identifying the expression for use in error messagestypeCheck
(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) Type-check the expressionMethods inherited from class net.sf.saxon.expr.AtomicSequenceConverter
allocateConverter, allocateConverter, allocateConverterStatically, convertItem, evaluateItem, getConverter, getConverterDynamically, getConvertingIterator, getImplementationMethod, getOperandRole, getRequiredItemType, getRoleSupplier, getStreamerName, iterate, makeDownCaster, optimize, setConverter, setRoleDiagnostic, simplify, toString
Methods inherited from class net.sf.saxon.expr.UnaryExpression
emitExtraAttributes, getBaseExpression, getOperand, operands, setBaseExpression
Methods inherited from class net.sf.saxon.expr.Expression
addToPathMap, adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, dispatchTailCall, dynamicError, effectiveBooleanValue, evaluateAsString, explain, getCardinality, getConfiguration, getCost, getDependencies, getEvaluationMethod, getExtraProperty, getIntegerBounds, 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, makeElaborator, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, prepareForStreaming, process, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setFlattened, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplifyChildren, staticTypeCheck, supportsLazyEvaluation, suppressValidation, toPattern, typeCheckChildren, typeError, unordered, verifyParentPointers, withLocation
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 Details
-
UntypedSequenceConverter
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 Details
-
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:AtomicSequenceConverter
Type-check the expression- Overrides:
typeCheck
in 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
protected int computeSpecialProperties()Determine the special properties of this expression- Overrides:
computeSpecialProperties
in classAtomicSequenceConverter
- Returns:
StaticProperty.NO_NODES_NEWLY_CREATED
.
-
copy
Copy an expression. This makes a deep copy.- Overrides:
copy
in classAtomicSequenceConverter
- Parameters:
rebindings
- variables that need to be re-bound- Returns:
- the copy of the original expression
-
getItemType
Determine the data type of the items returned by the expression, if possible- Overrides:
getItemType
in classAtomicSequenceConverter
- Returns:
- a value such as Type.STRING, Type.BOOLEAN, Type.NUMBER, Type.NODE, or Type.ITEM (meaning not known in advance)
-
computeCardinality
protected int computeCardinality()Determine the static cardinality of the expression- Overrides:
computeCardinality
in 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_ZERO
if the result is known to be an empty sequence, orStaticProperty.ALLOWS_MANY
if if is known to return a sequence of length two or more.
-
equals
Is this expression the same as another expression?- Overrides:
equals
in 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
protected int computeHashCode()get HashCode for comparing two expressions.- Overrides:
computeHashCode
in classAtomicSequenceConverter
- Returns:
- a computed hash code
-
displayOperator
Description copied from class:UnaryExpression
Give a string representation of the operator for use in diagnostics- Overrides:
displayOperator
in classAtomicSequenceConverter
- Parameters:
config
- the Saxon configuration- Returns:
- the operator, as a string
-
getExpressionName
Get a name identifying the kind of expression, in terms meaningful to a user.- Overrides:
getExpressionName
in 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
Description copied from class:Expression
Produce a short string identifying the expression for use in error messages- Overrides:
toShortString
in classUnaryExpression
- Returns:
- a short string, sufficient to identify the expression
-
export
Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.- Specified by:
export
in interfaceExportAgent
- Overrides:
export
in 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.
-
getElaborator
Make an elaborator for this expression- Overrides:
getElaborator
in classAtomicSequenceConverter
- Returns:
- a suitable elaborator
-