public final class NodeSet extends XPathResult
BOOLEAN, NODE_SET, NUMBER, STRING, USER_DEFINED
Constructor | Description |
---|---|
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.
|
Modifier and Type | Method | Description |
---|---|---|
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.
|
public NodeSet()
public NodeSet(XPathNode node)
node
- The node to include in the node-setpublic NodeSet(int size)
size
- The expected node-set sizepublic int getResultType()
getResultType
in class XPathResult
XPathResult.NODE_SET
public boolean booleanValue()
booleanValue
in class XPathResult
public double numberValue()
Double.NaN
if the
node-set is empty.numberValue
in class XPathResult
public java.lang.String stringValue()
Note: currently returns the string value of the first node in the node-set.
stringValue
in class XPathResult
public java.lang.Object javaObject()
NodeSet
representing this node-set.javaObject
in class XPathResult
public boolean equals(XPathResult result)
equals
in class XPathResult
result
- An XPath resultpublic int size()
public boolean add(XPathNode node)
node
- The node to add to this node-setpublic boolean add(XPathNode node, boolean ignoreDuplicates)
node
- The node to add to this node-setignoreDuplicates
- If true, do not perform duplicate checkingpublic void add(NodeSet nodeSet)
nodeSet
- The node-set from which to add nodespublic 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 searchpublic 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-setpublic 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 removepublic void clear()
public XPathNode[] toArray()
public java.lang.String toString()
toString
in class java.lang.Object