|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--org.exolab.adaptx.xpath.XPathResult
|
+--org.exolab.adaptx.xpath.NodeSet
Represents a node-set. A node-set is used as the result of an XPath expression, and during the expression to keep track of nodes being evaluated. As such, it is a mutable object. Care must be taken, as a node-set is not thread-safe and must not be used by two XPath expressions evaluating concurrently.
| Field Summary |
|---|
| Fields inherited from class org.exolab.adaptx.xpath.XPathResult |
|---|
BOOLEAN, NODE_SET, NUMBER, STRING, USER_DEFINED |
| Constructor Summary | |
|---|---|
NodeSet()
Constructs a new empty node-set. |
|
NodeSet(int size)
Constructs a new empty node-set with the specified size. |
|
NodeSet(XPathNode node)
Constructs a new node-set with the specified node. |
|
| Method Summary | |
|---|---|
void |
add(NodeSet nodeSet)
Adds all nodes from the specified node-set to this node-set without duplication. |
void |
add(NodeSet nodeSet,
boolean ignoreDuplicates)
Adds all nodes from the specified node-set to this node-set. |
boolean |
add(XPathNode node)
Adds the specified node to this node-set without duplication. |
boolean |
add(XPathNode node,
boolean ignoreDuplicates)
Adds the specified node to this node-set. |
boolean |
booleanValue()
Returns the result as a boolean value. |
void |
clear()
Removes all elements from this node-set. |
boolean |
contains(XPathNode node)
Returns true if the specified node is contained in this node-set. |
boolean |
equals(XPathResult result)
Returns true if the given result is a node-set result and has the same set of nodes. |
int |
getResultType()
Returns the type of this result. |
int |
indexOf(XPathNode node)
Returns the position of the specified node in this node-set. |
XPathNode |
item(int index)
Returns the node at the specified index. |
java.lang.Object |
javaObject()
Returns the result as a Java object. |
double |
numberValue()
Returns the result as a number value. |
void |
remove(int index)
Removes the specified node from the node-set. |
boolean |
remove(XPathNode node)
Removes the specified node from the node-set. |
int |
size()
Returns the number of nodes in the node-set. |
java.lang.String |
stringValue()
Returns the result as a string value. |
XPathNode[] |
toArray()
Returns an array containing all the nodes in this node-set. |
java.lang.String |
toString()
Returns the string representation of this NodeSet. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public NodeSet()
public NodeSet(XPathNode node)
node - The node to include in the node-setpublic NodeSet(int size)
size - The expected node-set size| Method Detail |
public int getResultType()
getResultType in class XPathResultXPathResult.NODE_SETpublic boolean booleanValue()
booleanValue in class XPathResultpublic double numberValue()
Double.NaN if the
node-set is empty.
numberValue in class XPathResultpublic java.lang.String stringValue()
Note: currently returns the string value of the first node in the node-set.
stringValue in class XPathResultpublic java.lang.Object javaObject()
NodeSet representing this node-set.
javaObject in class XPathResultpublic boolean equals(XPathResult result)
equals in class XPathResultresult - An XPath result
public int size()
public boolean add(XPathNode node)
node - The node to add to this node-set
public boolean add(XPathNode node,
boolean ignoreDuplicates)
node - The node to add to this node-setignoreDuplicates - If true, do not perform duplicate checking
public void add(NodeSet nodeSet)
nodeSet - The node-set from which to add nodes
public void add(NodeSet nodeSet,
boolean ignoreDuplicates)
nodeSet - The node-set from which to add nodesignoreDuplicates - If true, do not perform duplicate checking *public boolean contains(XPathNode node)
node - The specified node to search
public XPathNode item(int index)
IndexOutOfBoundsException is the index is out of range.
The index is as returned by indexOf(org.exolab.adaptx.xpath.XPathNode).
index - The position of the node to returnpublic int indexOf(XPathNode node)
The node's index is based on the order in which it was added to the node-set, minus any nodes of lower index position that were removed from the node-set. The index ranges between zero and size() - 1 (inclusive).
node - the Node to get the index forpublic boolean remove(XPathNode node)
node - The node to remove from this node-set
public void remove(int index)
IndexOutOfBoundsException
is the index is out of range. The index is as returned by
indexOf(org.exolab.adaptx.xpath.XPathNode).
index - The position of the node to remove
public void clear()
public XPathNode[] toArray()
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||