public abstract class AtomicValue extends Value implements Item
The AtomicValue class contains some methods that are suitable for applications to use, and many others that are designed for internal use by Saxon itself. These have not been fully classified. At present, therefore, none of the methods on this class should be considered to be part of the public Saxon API.
EMPTY_CLASS_ARRAY
EMPTY_VALUE_ARRAY
EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD
Constructor and Description |
---|
AtomicValue() |
Modifier and Type | Method and Description |
---|---|
void |
checkPermittedContents(SchemaType parentType,
StaticContext env,
boolean whole)
Check statically that the results of the expression are capable of constructing the content
of a given schema type.
|
AtomicValue |
convert(AtomicType targetType,
XPathContext context,
boolean validate)
Convert the value to a given type.
|
AtomicValue |
convert(int requiredType,
XPathContext context)
Convert the value to a given type.
|
abstract AtomicValue |
convertPrimitive(BuiltInAtomicType requiredType,
boolean validate,
XPathContext context)
Convert a value to another primitive data type, with control over how validation is
handled.
|
void |
display(int level,
NamePool pool,
PrintStream out)
Diagnostic print of expression structure
|
boolean |
effectiveBooleanValue(XPathContext context)
Get the effective boolean value of the value
|
String |
evaluateAsString(XPathContext context)
Evaluate as a string
|
Item |
evaluateItem(XPathContext context)
Evaluate the value (this simply returns the value unchanged)
|
int |
getCardinality()
Determine the static cardinality
|
AtomicValue |
getComponent(int component)
Method to extract components of a value.
|
int |
getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().
|
int |
getLength()
Get the length of the sequence
|
AtomicValue |
getPrimitiveValue()
Get the primitive value (the value in the value space).
|
abstract String |
getStringValue()
Convert the value to a string, using the serialization rules.
|
CharSequence |
getStringValueCS()
Get the value of the item as a CharSequence.
|
SequenceIterator |
getTypedValue()
Get the typed value of this item
|
boolean |
hasBuiltInType()
Test whether the type of this atomic value is a built-in type.
|
SequenceIterator |
iterate(XPathContext context)
Iterate over the (single) item in the sequence
|
void |
process(XPathContext context)
Process the instruction, without returning any tail calls
|
boolean |
schemaEquals(Value obj)
Compare two values for equality.
|
String |
toString()
Get string value.
|
asItem, asIterator, asValue, collapseWhitespace, convert, convertJavaObjectToXPath, convertToJava, equals, getDependencies, getItemType, getIterator, getParentExpression, getSpecialProperties, hashCode, itemAt, iterateSubExpressions, makeQNameValue, normalizeWhitespace, optimize, promote, reduce, simplify, stringToNumber, trimWhitespace, typeCheck
public boolean hasBuiltInType()
public int getImplementationMethod()
getImplementationMethod
in interface Expression
public void process(XPathContext context) throws XPathException
process
in interface Expression
process
in class Value
context
- The dynamic context, giving access to the current node,
the current variables, etc.XPathException
public final int getCardinality()
getCardinality
in interface Expression
getCardinality
in class Value
Cardinality
public final AtomicValue convert(int requiredType, XPathContext context) throws XPathException
requiredType
- type code of the required atomic typecontext
- XPathException
- if conversion is not allowed for this
required type, or if the particular value cannot be convertedpublic abstract AtomicValue convertPrimitive(BuiltInAtomicType requiredType, boolean validate, XPathContext context)
requiredType
- type code of the required atomic typevalidate
- true if validation is required. If set to false, the caller guarantees that
the value is valid for the target data type, and that further validation is therefore not required.
Note that a validation failure may be reported even if validation was not requested.context
- The conversion context to be used. This is required at present only when converting to
a date or time: it provides the implicit timezone.public AtomicValue convert(AtomicType targetType, XPathContext context, boolean validate)
targetType
- the type to which the value is to be convertedcontext
- provides access to conversion contextvalidate
- true if validation is required, false if the caller already knows that the
value is validValidationErrorValue
if conversion failed. The
caller must check for this condition. Validation may fail even if validation was not requested.public final int getLength()
public Item evaluateItem(XPathContext context) throws XPathException
evaluateItem
in interface Expression
evaluateItem
in class Value
context
- the evaluation context (not used in this implementation)XPathException
public final SequenceIterator iterate(XPathContext context)
iterate
in interface Expression
context
- the evaluation context (not used in this implementation)public final String evaluateAsString(XPathContext context)
evaluateAsString
in interface Expression
evaluateAsString
in class Value
context
- The context in which the expression is to be evaluatedpublic abstract String getStringValue()
getStringValue
in interface Item
getStringValue
in interface ValueRepresentation
getStringValue
in class Value
Item.getStringValueCS()
public CharSequence getStringValueCS()
getStringValueCS
in interface Item
Item.getStringValue()
public final SequenceIterator getTypedValue()
getTypedValue
in interface Item
public AtomicValue getPrimitiveValue()
Type.isPrimitiveType(int)
public boolean effectiveBooleanValue(XPathContext context) throws XPathException
effectiveBooleanValue
in interface Expression
effectiveBooleanValue
in class Value
context
- the evaluation context (not used in this implementation)XPathException
- if any dynamic error occurs evaluating the
expressionpublic AtomicValue getComponent(int component) throws XPathException
XPathException
public void checkPermittedContents(SchemaType parentType, StaticContext env, boolean whole) throws XPathException
checkPermittedContents
in interface Expression
checkPermittedContents
in class Value
parentType
- The schema typeenv
- the static contextwhole
- true if this atomic value accounts for the entire content of the containing nodeXPathException
- if the expression doesn't match the required content typepublic String toString()
public boolean schemaEquals(Value obj)
schemaEquals
in class Value
public final void display(int level, NamePool pool, PrintStream out)
display
in interface Expression
display
in class Value
level
- the indentation level of the outputout
- pool
- NamePool used to expand any names appearing in the expression