jd.xml.xpath.object
Class XNodeSet

java.lang.Object
  extended byjd.xml.xpath.object.XObject
      extended byjd.xml.xpath.object.XNodeSet
Direct Known Subclasses:
XEmptyNodeSet, XMutableNodeSet, XResultTreeFragment, XTextContentFragment

public abstract class XNodeSet
extends XObject

XNodeSet represents a XPath object with type node-set.


Field Summary
static int ORDER_CONVERTIBLE
          A ordering constant for nodesets that can be converted to another XPath type (and therefore store only the first added node)
static int ORDER_COUNTED
          A ordering constant for counted nodesets (i.e.
static int ORDER_ORDERED
          A ordering constant for ordered nodesets.
static int ORDER_SUMMARIZED
          A ordering constant for summarized nodesets (i.e.
static int ORDER_UNORDERED
          A ordering constant for unordered nodesets.
 
Fields inherited from class jd.xml.xpath.object.XObject
TYPE_BOOLEAN, TYPE_NODESET, TYPE_NUMBER, TYPE_STRING, TYPE_VARIABLE, TYPES
 
Constructor Summary
XNodeSet()
           
 
Method Summary
 int canConvertTo(Class javaClass)
          Test if the XObject can be converted to an object with the given class.
 boolean compare(Equality equality, double value)
          Return if this XObject equals the given value.
 boolean compare(Equality equality, String value)
          Return if this XObject equals the given value.
 boolean compare(Equality equality, XNodeSet set)
          Return if this XObject equals the given nodeSet.
 boolean compare(Equality equality, XObject object)
          Return if this XNodeSet equals the given value.
 boolean compare(Relation relation, double number)
          Compare this XObject to the number value according the given relation.
 boolean compare(Relation relation, XNodeSet set)
          Compare this XObject to the number value according the given relation.
 boolean compare(Relation relation, XObject object)
          Compare this XObject to the other object according the given relation.
 boolean contains(String value)
          Test if the nodeset contains a node whose stringvalue equals the given value.
 boolean contains(XPathNode node)
          Test if the nodeset contains a node who equals the given node.
(package private)  int getDocId()
          Return the document id of the nodes in this nodeSet or -1 if the nodes come from different documents.
abstract  XPathNode getNode(int index)
          Get the node for the given index.
 double getNodeSum()
          Get the sum of the number value of all nodes in this nodeset.
 int getOrdering()
          Return the ordering of this NodeSet.
 int getType()
          Return XObject.TYPE_NODESET
 int indexOf(XPathNode node)
          Return the index of the node in this NodeSet or -1 if the NodeSet does not contain the node.
 boolean isEmpty()
          Return if the nodeset is empty.
 boolean isOrdered()
          Return if this NodeSet is ordered.
static boolean isOrdered(int ordering)
          Return if this ordering constant signal that nodes have to be added in order.
(package private)  void setDocId(int docId)
          Set the document id of the nodes in this nodeSet.
(package private)  void setMultiDocId()
          Set the document id of the nodes in this nodeSet.
abstract  int size()
          Return the size of the NodeSet.
 boolean toBooleanValue()
          Return if the nodeset is not empty.
 XNodeSet toNodeSet()
          Return this.
 double toNumberValue()
          Convert the string value of this NodeSet to a number.
 double toNumberValue(int i)
          Return the number value of the i-th node.
 String toString()
          Return a debug string representation of this XObject.
 String toStringValue()
          Return an empty string if this nodeset is empty or the string value of the first node otherwise.
 String toStringValue(int i)
          Return the string value of the i-th node.
 Object toValue()
          Return this.
 Object toValue(Class javaClass)
          Convert the objects value to an object of the given class.
 
Methods inherited from class jd.xml.xpath.object.XObject
compare, equals, getTypeName, getTypeName, hashCode, toXObject
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ORDER_ORDERED

public static final int ORDER_ORDERED
A ordering constant for ordered nodesets.

See Also:
getOrdering(), Constant Field Values

ORDER_UNORDERED

public static final int ORDER_UNORDERED
A ordering constant for unordered nodesets.

See Also:
getOrdering(), Constant Field Values

ORDER_COUNTED

public static final int ORDER_COUNTED
A ordering constant for counted nodesets (i.e. nodesets that store only size information).

See Also:
getOrdering(), Constant Field Values

ORDER_SUMMARIZED

public static final int ORDER_SUMMARIZED
A ordering constant for summarized nodesets (i.e. nodesets that store only size and node sum information).

See Also:
getOrdering(), Constant Field Values

ORDER_CONVERTIBLE

public static final int ORDER_CONVERTIBLE
A ordering constant for nodesets that can be converted to another XPath type (and therefore store only the first added node)

See Also:
getOrdering(), Constant Field Values
Constructor Detail

XNodeSet

public XNodeSet()
Method Detail

getType

public int getType()
Return XObject.TYPE_NODESET

Specified by:
getType in class XObject

getOrdering

public int getOrdering()
Return the ordering of this NodeSet.


isOrdered

public boolean isOrdered()
Return if this NodeSet is ordered.


isOrdered

public static boolean isOrdered(int ordering)
Return if this ordering constant signal that nodes have to be added in order.


toValue

public Object toValue()
Return this.

Specified by:
toValue in class XObject

canConvertTo

public int canConvertTo(Class javaClass)
Test if the XObject can be converted to an object with the given class.

Specified by:
canConvertTo in class XObject
Returns:
a positive integer if conversion is possible. The value indicates the conversion preference. A zero value indicates that conversion is not possible.

toValue

public Object toValue(Class javaClass)
Convert the objects value to an object of the given class. If the conversion is not possible return null.

Specified by:
toValue in class XObject

toBooleanValue

public boolean toBooleanValue()
Return if the nodeset is not empty.

Specified by:
toBooleanValue in class XObject

toNumberValue

public double toNumberValue()
Convert the string value of this NodeSet to a number.

Specified by:
toNumberValue in class XObject

toNumberValue

public double toNumberValue(int i)
Return the number value of the i-th node.


toStringValue

public String toStringValue()
Return an empty string if this nodeset is empty or the string value of the first node otherwise.

Specified by:
toStringValue in class XObject

toStringValue

public String toStringValue(int i)
Return the string value of the i-th node. Specialized node-set classes can provide an optimized implementation.


toNodeSet

public XNodeSet toNodeSet()
Return this.

Overrides:
toNodeSet in class XObject

size

public abstract int size()
Return the size of the NodeSet.


isEmpty

public boolean isEmpty()
Return if the nodeset is empty.


getNode

public abstract XPathNode getNode(int index)
Get the node for the given index.


getNodeSum

public double getNodeSum()
Get the sum of the number value of all nodes in this nodeset.


indexOf

public int indexOf(XPathNode node)
Return the index of the node in this NodeSet or -1 if the NodeSet does not contain the node.


contains

public boolean contains(XPathNode node)
Test if the nodeset contains a node who equals the given node.


contains

public boolean contains(String value)
Test if the nodeset contains a node whose stringvalue equals the given value.


getDocId

int getDocId()
Return the document id of the nodes in this nodeSet or -1 if the nodes come from different documents.


setDocId

void setDocId(int docId)
Set the document id of the nodes in this nodeSet.


setMultiDocId

void setMultiDocId()
Set the document id of the nodes in this nodeSet.


compare

public boolean compare(Equality equality,
                       String value)
Return if this XObject equals the given value.

Specified by:
compare in class XObject

compare

public boolean compare(Equality equality,
                       double value)
Return if this XObject equals the given value.

Overrides:
compare in class XObject

compare

public boolean compare(Equality equality,
                       XNodeSet set)
Return if this XObject equals the given nodeSet.


compare

public boolean compare(Equality equality,
                       XObject object)
Return if this XNodeSet equals the given value.

Overrides:
compare in class XObject

compare

public boolean compare(Relation relation,
                       double number)
Compare this XObject to the number value according the given relation.

Overrides:
compare in class XObject

compare

public boolean compare(Relation relation,
                       XNodeSet set)
Compare this XObject to the number value according the given relation.


compare

public boolean compare(Relation relation,
                       XObject object)
Compare this XObject to the other object according the given relation.

Overrides:
compare in class XObject

toString

public String toString()
Return a debug string representation of this XObject.

Overrides:
toString in class XObject