|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exist.xquery.value.AtomicValue
Represents an atomic value. All simple values that are not nodes extend AtomicValue. As every single item is also a sequence, this class implements both: Item and Sequence.
Field Summary | |
static AtomicValue |
EMPTY_VALUE
An empty atomic value |
Fields inherited from interface org.exist.xquery.value.Sequence |
EMPTY_SEQUENCE |
Constructor Summary | |
AtomicValue()
|
Method Summary | |
void |
add(Item item)
Add an item to the current sequence. |
void |
addAll(Sequence other)
Add all items of the other sequence to this item. |
AtomicValue |
atomize()
|
void |
clearContext(int contextId)
For every item in the sequence, clear any context-dependant information that is stored during query processing. |
abstract int |
compareTo(java.text.Collator collator,
AtomicValue other)
|
abstract boolean |
compareTo(java.text.Collator collator,
int operator,
AtomicValue other)
|
int |
compareTo(java.lang.Object other)
|
boolean |
contains(java.text.Collator collator,
AtomicValue other)
Compares this atomic value to another. |
int |
conversionPreference(java.lang.Class javaClass)
Returns a preference indicator, indicating the preference of a value to be converted into the given Java class. |
abstract AtomicValue |
convertTo(int requiredType)
Convert this item into an atomic value, whose type corresponds to the specified target type. |
void |
copyTo(DBBroker broker,
DocumentBuilderReceiver receiver)
|
static AtomicValue |
deserialize(byte[] data,
int start,
int len)
|
void |
dump(ExpressionDumper dumper)
Dump a string representation of this value to the given ExpressionDumper. |
boolean |
effectiveBooleanValue()
Get the effective boolean value of this sequence. |
boolean |
endsWith(java.text.Collator collator,
AtomicValue other)
Compares this atomic value to another. |
int |
getCardinality()
Returns the cardinality of this sequence. |
DocumentSet |
getDocumentSet()
Returns the set of documents from which the node items in this sequence have been selected. |
int |
getItemType()
Return the primary type to which all items in this sequence belong. |
int |
getLength()
Returns the number of items contained in the sequence. |
abstract java.lang.String |
getStringValue()
Return the string value of this item (see the definition of string value in XPath). |
int |
getType()
Return the type of this item according to the type constants defined in class Type . |
boolean |
hasMany()
Returns whether the sequence more than one item or not. |
boolean |
hasOne()
Returns whether the sequence has just one item or not. |
boolean |
isCached()
Returns true if the sequence is the result of a previous operation and has been cached. |
boolean |
isEmpty()
Returns whether the sequence is empty or not. |
boolean |
isPersistentSet()
|
Item |
itemAt(int pos)
Returns the item located at the specified position within this sequence. |
SequenceIterator |
iterate()
Returns an iterator over all items in the sequence. |
abstract AtomicValue |
max(java.text.Collator collator,
AtomicValue other)
|
abstract AtomicValue |
min(java.text.Collator collator,
AtomicValue other)
|
AtomicValue |
promote(AtomicValue otherValue)
|
void |
removeDuplicates()
Explicitely remove all duplicate nodes from this sequence. |
byte[] |
serialize(short collectionId,
boolean caseSensitive)
Serialize the value plus collection and possibly element information to an array of bytes. |
byte[] |
serializeValue(int offset,
boolean caseSensitive)
Serialize the value to an array of bytes for the persistant storage. |
void |
setIsCached(boolean cached)
Indicates that the sequence is the result of a previous operation and has not been recomputed. |
void |
setSelfAsContext(int contextId)
|
boolean |
startsWith(java.text.Collator collator,
AtomicValue other)
Compares this atomic value to another. |
java.lang.Object |
toJavaObject(java.lang.Class target)
Convert the value into an instance of the specified Java class. |
NodeSet |
toNodeSet()
Convert the sequence into a NodeSet. |
void |
toSAX(DBBroker broker,
org.xml.sax.ContentHandler handler)
|
Sequence |
toSequence()
Convert this item into a sequence, containing only the item. |
java.lang.String |
toString()
|
SequenceIterator |
unorderedIterator()
Returns an iterator over all items in the sequence. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final AtomicValue EMPTY_VALUE
Constructor Detail |
public AtomicValue()
Method Detail |
public int getType()
Item
Type
.
getType
in interface Item
public abstract java.lang.String getStringValue() throws XPathException
Item
getStringValue
in interface Item
XPathException
public abstract AtomicValue convertTo(int requiredType) throws XPathException
Item
Type
. An XPathException
is thrown
if the conversion is impossible.
convertTo
in interface Item
requiredType
-
XPathException
public abstract boolean compareTo(java.text.Collator collator, int operator, AtomicValue other) throws XPathException
XPathException
public abstract int compareTo(java.text.Collator collator, AtomicValue other) throws XPathException
XPathException
public abstract AtomicValue max(java.text.Collator collator, AtomicValue other) throws XPathException
XPathException
public abstract AtomicValue min(java.text.Collator collator, AtomicValue other) throws XPathException
XPathException
public boolean startsWith(java.text.Collator collator, AtomicValue other) throws XPathException
collator
- Collator used for string comparison.other
-
XPathException
- if this is not a string.public boolean endsWith(java.text.Collator collator, AtomicValue other) throws XPathException
collator
- Collator used for string comparison.other
-
XPathException
- if this is not a string.public boolean contains(java.text.Collator collator, AtomicValue other) throws XPathException
collator
- Collator used for string comparison.other
-
XPathException
- if this is not a string.public int getLength()
Sequence
getLength
in interface Sequence
public int getCardinality()
Sequence
Cardinality
.
getCardinality
in interface Sequence
Cardinality
public void removeDuplicates()
Sequence
removeDuplicates
in interface Sequence
public SequenceIterator iterate() throws XPathException
Sequence
iterate
in interface Sequence
XPathException
- TODOpublic SequenceIterator unorderedIterator()
Sequence
unorderedIterator
in interface Sequence
public int getItemType()
Sequence
Type.NODE
for node sets, Type.ITEM
for other sequences with mixed items.
getItemType
in interface Sequence
public Item itemAt(int pos)
Sequence
itemAt
in interface Sequence
pos
- public Sequence toSequence()
Item
toSequence
in interface Item
public void toSAX(DBBroker broker, org.xml.sax.ContentHandler handler) throws org.xml.sax.SAXException
toSAX
in interface Item
org.xml.sax.SAXException
public void copyTo(DBBroker broker, DocumentBuilderReceiver receiver) throws org.xml.sax.SAXException
copyTo
in interface Item
org.xml.sax.SAXException
public boolean isEmpty()
Sequence
isEmpty
in interface Sequence
true
is the sequence is emptypublic boolean hasOne()
Sequence
hasOne
in interface Sequence
true
is the sequence has just one itempublic boolean hasMany()
Sequence
hasMany
in interface Sequence
true
is the sequence more than one itempublic void add(Item item) throws XPathException
Sequence
XPathException
may be thrown
if the item's type is incompatible with this type of sequence (e.g. if the sequence
is a node set).
The sequence may or may not allow duplicate values.
add
in interface Sequence
item
-
XPathException
public void addAll(Sequence other) throws XPathException
Sequence
XPathException
may
be thrown if the type of the items in the other sequence is incompatible with
the primary type of this sequence.
addAll
in interface Sequence
other
-
XPathException
public AtomicValue atomize() throws XPathException
atomize
in interface Item
XPathException
public boolean effectiveBooleanValue() throws XPathException
Sequence
effectiveBooleanValue
in interface Sequence
XPathException
public NodeSet toNodeSet() throws XPathException
Sequence
toNodeSet
in interface Sequence
XPathException
- if the sequence contains items which are not nodes.public DocumentSet getDocumentSet()
Sequence
getDocumentSet
in interface Sequence
public AtomicValue promote(AtomicValue otherValue) throws XPathException
XPathException
public void dump(ExpressionDumper dumper)
dumper
- public int conversionPreference(java.lang.Class javaClass)
Sequence
conversionPreference
in interface Item
public java.lang.Object toJavaObject(java.lang.Class target) throws XPathException
Sequence
toJavaObject
in interface Item
XPathException
public java.lang.String toString()
public boolean isCached()
Sequence
isCached
in interface Sequence
public void setIsCached(boolean cached)
Sequence
setIsCached
in interface Sequence
cached
- public void clearContext(int contextId)
Sequence
clearContext
in interface Sequence
public void setSelfAsContext(int contextId)
setSelfAsContext
in interface Sequence
public boolean isPersistentSet()
isPersistentSet
in interface Sequence
public static final AtomicValue deserialize(byte[] data, int start, int len) throws EXistException
EXistException
public byte[] serialize(short collectionId, boolean caseSensitive) throws EXistException
Indexable
serialize
in interface Indexable
collectionId
- the collection id to usecaseSensitive
- only relevant for string values: if set to false,
strings should be serialized in lower case
EXistException
public byte[] serializeValue(int offset, boolean caseSensitive) throws EXistException
Indexable
serializeValue
in interface Indexable
offset
- starting index for writing in array data
EXistException
public int compareTo(java.lang.Object other)
compareTo
in interface java.lang.Comparable
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |