|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.novell.xml.xpath.NodeSet
Class to represent a node-set expression value
Nested Class Summary | |
protected class |
NodeSet.Mark
|
Field Summary | |
protected static Class |
argType
|
protected static DocumentOrderComparator |
nodeComparator
|
protected Set |
set
|
Fields inherited from interface com.novell.xml.xpath.ExpressionValue |
BOOLEAN, EXTENDED, NATIVE, NODE_SET, NUMBER, STRING |
Fields inherited from interface com.novell.xml.xpath.ContextNodeList |
DOCUMENT_ORDER, REVERSE_DOCUMENT_ORDER, UNKNOWN_ORDER |
Constructor Summary | |
NodeSet()
Construct a new, empty node-set |
|
NodeSet(Collection copy)
Construct a new node-set and initialize it to contain the members in the passed collection |
|
NodeSet(NodeSet copy)
Construct a new node-set with the same content as the passed node-set |
Method Summary | |
void |
add(DocumentFragment fragment)
Add (the children of) a DocumentFragment to a node-set If any node is a duplicate of a member of the set it will not be added |
void |
add(Node node)
Add an arbitrary node to a node-set. |
void |
castFrom(Object type)
Convert from a different type of expression value to the NodeSet type NOTE: this will ALWAYS throw an exception (unless the "from" type is a node-set), since there is no type type can be converted to a node-set |
boolean |
contains(Node node)
Return true if the passed node is contained in the set |
int |
count()
Return a count of nodes in the context node list. |
void |
dump(PrintWriter writer)
Output a human-readable form for the value |
void |
dump(PrintWriter writer,
int indent)
Print the expression in a readable form for debugging. |
ExpressionValue |
evaluate(Node contextNode,
ExpressionContext context)
Evaluate the expression with repect to the passed context |
Node |
first()
Return the first node in the context node list. |
static Class |
getArgType()
Return the Class object for objects of this type. |
boolean |
getBooleanValue()
Return boolean value of expression value (will convert to boolean if value is not of type boolean) |
ContextListMark |
getMark()
Return a marker to a position in a ContextNodeList. |
Object |
getNativeValue()
return the underlying native value (java.lang.Boolean, java.lang.Double, etc.) |
NodeSet |
getNodeSetValue()
Return node-set value of this ExpressionValue. |
double |
getNumberValue()
Return numeric value of ExpressionValue. |
Class |
getResultType()
Return the Class object describing the result type of the expression. |
String |
getStringValue()
Return string value of this ExpressionValue. |
int |
getValueType()
Return type of expression value |
boolean |
isConstant()
Return true if the expression is a constant value. |
boolean |
isEmpty()
Return true if this node-set has no members |
Node |
next()
Return a the subsequent node in the context node list after a call to first() or next() |
int |
order()
Return order in which nodes are returned from first()-next() |
int |
position()
Return the position of the last node returned by a call to first() or next() |
void |
registerForReset(XPathResetRegistrar registrar)
Register this expression or any subexpression that implements XPathResetCache with an object that wants to call resetCache() |
void |
remove(Node node)
Remove a member of the node-set. |
Node |
returnToMark(ContextListMark mark)
Go to a position in a ContextNodeList previously marked with getMark() |
String |
toString()
Provide a readable description for debugging. |
void |
union(NodeSet rhs)
Perform a union operation between this node-set and another node-set. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Set set
protected static Class argType
protected static DocumentOrderComparator nodeComparator
Constructor Detail |
public NodeSet()
public NodeSet(Collection copy) throws Exception
copy
- A collection of Node objects
Exception
- Errorpublic NodeSet(NodeSet copy)
copy
- The node-set to copyMethod Detail |
public static Class getArgType()
This is used for FunctionSignature objects.
public void add(Node node)
node
- node to addpublic void add(DocumentFragment fragment)
fragment
- DocumentFragment to addpublic void remove(Node node)
node
- The node to be removedpublic boolean contains(Node node)
node
- The node to check
public void union(NodeSet rhs)
rhs
- The right-hand operand of the union operatorpublic boolean isEmpty()
public String toString()
public ExpressionValue evaluate(Node contextNode, ExpressionContext context)
evaluate
in interface Expression
contextNode
- context node for expression evaluationcontext
- expression context for expression evaluation
public boolean isConstant()
isConstant
in interface Expression
public Class getResultType()
getResultType
in interface Expression
public void registerForReset(XPathResetRegistrar registrar)
resetCache()
registerForReset
in interface Expression
public void dump(PrintWriter writer, int indent)
dump
in interface Expression
writer
- The output device.indent
- Number of tabs to indent the result.public int getValueType()
getValueType
in interface ExpressionValue
public void castFrom(Object type) throws XPathConversionException
NOTE: this will ALWAYS throw an exception (unless the "from" type is a node-set), since there is no type type can be converted to a node-set
castFrom
in interface ExpressionValue
type
- The object to convert from.
XPathConversionException
public boolean getBooleanValue() throws XPathConversionException
getBooleanValue
in interface ExpressionValue
XPathConversionException
public double getNumberValue() throws XPathConversionException
getNumberValue
in interface ExpressionValue
XPathConversionException
public String getStringValue()
getStringValue
in interface ExpressionValue
public NodeSet getNodeSetValue() throws XPathConversionException
getNodeSetValue
in interface ExpressionValue
XPathConversionException
public Object getNativeValue()
getNativeValue
in interface ExpressionValue
public void dump(PrintWriter writer)
dump
in interface ExpressionValue
writer
- Output devicepublic Node first()
first
in interface ContextNodeList
public Node next()
next
in interface ContextNodeList
public int count()
NOTE: this should be implemented with lazy evaluation if possible, since context node lists can be very large, depending on the document.
count
in interface ContextNodeList
public int position()
position
in interface ContextNodeList
public int order()
order
in interface ContextNodeList
public ContextListMark getMark()
getMark
in interface ContextNodeList
public Node returnToMark(ContextListMark mark)
returnToMark
in interface ContextNodeList
mark
- mark returned from getMark()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |