net.sf.saxon.expr
public final class CastExpression extends UnaryExpression
Field Summary | |
---|---|
static IntHashMap<int[]> | castingTable |
Constructor Summary | |
---|---|
CastExpression(Expression source, AtomicType target, boolean allowEmpty)
Create a cast expression |
Method Summary | |
---|---|
static void | addAllowedCasts(int source, int[] target) |
boolean | allowsEmpty()
Ask whether the expression accepts an empty sequence as input (producing an empty sequence as output) |
static AtomicValue | castStringToQName(CharSequence operand, AtomicType targetType, StaticContext env)
Evaluate the "pseudo-cast" of a string literal to a QName or NOTATION value. |
int | computeCardinality()
Get the static cardinality of the expression |
int | computeSpecialProperties()
Determine the special properties of this expression |
Expression | copy()
Copy an expression. |
boolean | equals(Object other)
Is this expression the same as another expression? |
Item | evaluateItem(XPathContext context)
Evaluate the expression |
void | explain(ExpressionPresenter out)
Diagnostic print of expression structure. |
ItemType | getItemType(TypeHierarchy th)
Get the static type of the expression |
AtomicType | getTargetPrimitiveType()
Get the primitive base type of the target type of the cast |
AtomicType | getTargetType()
Get the target type (the result type) |
static boolean | isPossibleCast(int source, int target)
Determine whether casting from a source type to a target type is possible |
boolean | isUpCast()
Ask whether this is a cast to a supertype of the original type |
Expression | simplify(ExpressionVisitor visitor)
Simplify the expression |
boolean | targetIsDerived()
Ask whether the target type is a derived type (not a primitive type) |
String | toString()
The toString() method for an expression attempts to give a representation of the expression
in an XPath-like form, but there is no guarantee that the syntax will actually be true XPath.
|
Expression | typeCheck(ExpressionVisitor visitor, ItemType contextItemType)
Type-check the expression |
Parameters: source expression giving the value to be converted target the type to which the value is to be converted allowEmpty true if the expression allows an empty sequence as input, producing an empty sequence as output. If false, an empty sequence is a type error.
Returns: true if an empty sequence is accepted
Parameters: operand the value to be converted targetType the type to which it is to be converted env the static context
Returns: the QName or NOTATION value that results from casting the string to a QName. This will either be a QNameValue or a derived AtomicValue derived from QName or NOTATION
Returns: NON_CREATIVE.
Returns: the copy of the original expression
Parameters: th the type hierarchy cache
Returns: the primitive type of the target type
Returns: the target type
Parameters: source a primitive type (one that has an entry in the casting table) target another primitive type
Returns: true if the entry in the casting table is either "Y" (casting always succeeds) or "M" (casting allowed but may fail for some values)
Returns: true if this is an upcast. This means the value stays unchanged and only the type label changes
Parameters: visitor an expression visitor
Returns: the simplified expression
Returns: true if the target type is a derived type