com.xml_project.morganaxdm
Class XdmItem

java.lang.Object
  extended by com.xml_project.morganaxdm.XdmSequence
      extended by com.xml_project.morganaxdm.XdmItem
All Implemented Interfaces:
java.lang.Iterable<XdmItem>
Direct Known Subclasses:
Array, Map, ModelNode, XdmValue

public abstract class XdmItem
extends XdmSequence

The basic value token in XDM: Either a value (atomic, map or array) or a node.


Constructor Summary
XdmItem()
           
 
Method Summary
 AtomizingIterator atomize()
          Returns an AtomizingIterator which gives access to the atomized value of the elements in this sequence.
 XdmItem first()
          Returns the first item of this XdmSequence or throws a RuntimeException if sequence is empty.
 XdmItem get(long nr)
          Returns the n-th element of the sequence, counting by 1.
abstract  java.lang.String getStringValue()
          Returns the string value.
abstract  java.lang.Object getValue()
          Returns the value itself.
 boolean hasValues()
          Checks whether the sequences contains XdmValues as opposed to nodes.
 boolean isEmpty()
          Checks whether the sequence is empty.
abstract  boolean isValue()
          Flags, this item is a value as opposed to a node
 XdmItemIterator iterator()
          Returns an iterator over this XdmSequence.
 long size()
          Returns the number of elements in this sequence.
 XdmSequence subSequence(long first, java.lang.Double length)
          Creates a new sequence which contains the element (first..length) of this sequence.
 
Methods inherited from class com.xml_project.morganaxdm.XdmSequence
concat, hasCommonType, normalize, serialize, serialize, serialize, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XdmItem

public XdmItem()
Method Detail

getStringValue

public abstract java.lang.String getStringValue()
Returns the string value.

Overrides:
getStringValue in class XdmSequence
Returns:
the string value.

getValue

public abstract java.lang.Object getValue()
Returns the value itself.

Returns:
the value.

isValue

public abstract boolean isValue()
Flags, this item is a value as opposed to a node

Returns:
true, if this item is an XDMValue and not a node()

iterator

public XdmItemIterator iterator()
Description copied from class: XdmSequence
Returns an iterator over this XdmSequence.

Specified by:
iterator in interface java.lang.Iterable<XdmItem>
Overrides:
iterator in class XdmSequence

first

public XdmItem first()
              throws java.lang.RuntimeException
Description copied from class: XdmSequence
Returns the first item of this XdmSequence or throws a RuntimeException if sequence is empty.

Overrides:
first in class XdmSequence
Returns:
the first item of this sequence.
Throws:
java.lang.RuntimeException - if the sequence is empty.

get

public XdmItem get(long nr)
Description copied from class: XdmSequence
Returns the n-th element of the sequence, counting by 1. Invoking this method will convert the underlying sequence to a materialized sequence which will take time and cost memory. See also size().

Overrides:
get in class XdmSequence
Parameters:
nr - the number of the element, based by 1!
Returns:
the element on the given position.

atomize

public AtomizingIterator atomize()
                          throws XPathException
Description copied from class: XdmSequence
Returns an AtomizingIterator which gives access to the atomized value of the elements in this sequence.

Overrides:
atomize in class XdmSequence
Returns:
an AtomizingIterator.
Throws:
XPathException - thrown, if the sequence contains elements which cannot be atomized.

size

public long size()
Description copied from class: XdmSequence
Returns the number of elements in this sequence. Invoking this method will convert the underlying sequence to a materialized sequence which will take time and cost memory. See also get(n).

Overrides:
size in class XdmSequence
Returns:
the number of elements in this sequence.

hasValues

public boolean hasValues()
Description copied from class: XdmSequence
Checks whether the sequences contains XdmValues as opposed to nodes.

Overrides:
hasValues in class XdmSequence
Returns:
true, if there is at least one value.

isEmpty

public boolean isEmpty()
Description copied from class: XdmSequence
Checks whether the sequence is empty.

Overrides:
isEmpty in class XdmSequence
Returns:
true, if the sequence is empty.

subSequence

public XdmSequence subSequence(long first,
                               java.lang.Double length)
                        throws XPathException
Description copied from class: XdmSequence
Creates a new sequence which contains the element (first..length) of this sequence.

Overrides:
subSequence in class XdmSequence
Parameters:
first - the first element (counting by 1) to include.
length - the number of elements to include.
Returns:
a new sequence as a subsequence of this sequence.
Throws:
XPathException - thrown the sequence cannot be created.