Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.novell.xml.xpath
Class NodeSet

    java.lang.Object
      com.novell.xml.xpath.NodeSet

All Implemented Interfaces:
  ContextNodeList, Expression, ExpressionValue

Direct Known Subclasses:
  InsertionOrderNodeSet

    public class NodeSet

extends Object
implements ExpressionValue, Expression, ContextNodeList

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

### set

    protected Set set

### argType

    protected static Class argType

### nodeComparator

    protected static DocumentOrderComparator nodeComparator

Constructor Detail

### NodeSet

    public NodeSet()

  Construct a new, empty node-set

### NodeSet

    public NodeSet(Collection copy)
            throws Exception

  Construct a new node-set and initialize it to contain the members in the passed collection

  Parameters:
    `copy` - A collection of Node objects
  Throws:
    `Exception` - Error

### NodeSet

    public NodeSet(NodeSet copy)

  Construct a new node-set with the same content as the passed node-set

  Parameters:
    `copy` - The node-set to copy

Method Detail

### getArgType

    public static Class getArgType()

  Return the Class object for objects of this type.

  This is used for FunctionSignature objects.

  Returns:
    The Class object corresponding to NodeSet

### add

    public void add(Node node)

  Add an arbitrary node to a node-set. If the node is a duplicate of a member of the set it will not be added

  Parameters:
    `node` - node to add

### add

    public 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

  Parameters:
    `fragment` - DocumentFragment to add

### remove

    public void remove(Node node)

  Remove a member of the node-set.

  Parameters:
    `node` - The node to be removed

### contains

    public boolean contains(Node node)

  Return true if the passed node is contained in the set

  Parameters:
    `node` - The node to check
  Returns:
    True if the passed node is contained in the set

### union

    public void union(NodeSet rhs)

  Perform a union operation between this node-set and another node-set. The resulting union will be in document order.

  Parameters:
    `rhs` - The right-hand operand of the union operator

### isEmpty

    public boolean isEmpty()

  Return true if this node-set has no members

  Returns:
    true is node-set is empty, false otherwise

### toString

    public String toString()

  Provide a readable description for debugging.

  Overrides:
    `toString` in class `Object`
  Returns:
    String representation

### evaluate

    public ExpressionValue evaluate(Node contextNode,
                                    ExpressionContext context)

  Evaluate the expression with repect to the passed context

  Specified by:
    `evaluate` in interface `Expression`
  Parameters:
    `contextNode` - context node for expression evaluation
    `context` - expression context for expression evaluation
  Returns:
    result of evaluating expression

### isConstant

    public boolean isConstant()

  Return true if the expression is a constant value.

  Specified by:
    `isConstant` in interface `Expression`
  Returns:
    True is expression is constant, false otherwise.

### getResultType

    public Class getResultType()

  Return the Class object describing the result type of the expression.

  Specified by:
    `getResultType` in interface `Expression`
  Returns:
    A Class object.

### registerForReset

    public void registerForReset(XPathResetRegistrar registrar)

  Register this expression or any subexpression that implements XPathResetCache with an object that wants to call `resetCache()`

  Specified by:
    `registerForReset` in interface `Expression`

### dump

    public void dump(PrintWriter writer,
                     int indent)

  Print the expression in a readable form for debugging.

  Specified by:
    `dump` in interface `Expression`
  Parameters:
    `writer` - The output device.
    `indent` - Number of tabs to indent the result.

### getValueType

    public int getValueType()

  Return type of expression value

  Specified by:
    `getValueType` in interface `ExpressionValue`
  Returns:
    ExpressionValue.BOOLEAN, ExpressionValue.NUMBER, etc.

### castFrom

    public void castFrom(Object type)
                  throws XPathConversionException

  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

  Specified by:
    `castFrom` in interface `ExpressionValue`
  Parameters:
    `type` - The object to convert from.
  Throws:
    `XPathConversionException`

### getBooleanValue

    public boolean getBooleanValue()
                            throws XPathConversionException

  Return boolean value of expression value (will convert to boolean if value is not of type boolean)

  Specified by:
    `getBooleanValue` in interface `ExpressionValue`
  Returns:
    true or false
  Throws:
    `XPathConversionException`

### getNumberValue

    public double getNumberValue()
                          throws XPathConversionException

  Return numeric value of ExpressionValue. Will convert to a number if value is not of NUMBER type

  Specified by:
    `getNumberValue` in interface `ExpressionValue`
  Returns:
    numeric value
  Throws:
    `XPathConversionException`

### getStringValue

    public String getStringValue()

  Return string value of this ExpressionValue. Will convert to a string if underlying type is not string.

  Specified by:
    `getStringValue` in interface `ExpressionValue`
  Returns:
    String value of ExpressionValue

### getNodeSetValue

    public NodeSet getNodeSetValue()
                            throws XPathConversionException

  Return node-set value of this ExpressionValue. Will NOT convert an underlying type to a node-set.

  Specified by:
    `getNodeSetValue` in interface `ExpressionValue`
  Throws:
    `XPathConversionException`

### getNativeValue

    public Object getNativeValue()

  return the underlying native value (java.lang.Boolean, java.lang.Double, etc.)

  Specified by:
    `getNativeValue` in interface `ExpressionValue`
  Returns:
    The native java class that is the value

### dump

    public void dump(PrintWriter writer)

  Output a human-readable form for the value

  Specified by:
    `dump` in interface `ExpressionValue`
  Parameters:
    `writer` - Output device

### first

    public Node first()

  Return the first node in the context node list.

  Specified by:
    `first` in interface `ContextNodeList`
  Returns:
    First node in list. null is returned if list is empty

### next

    public Node next()

  Return a the subsequent node in the context node list after a call to first() or next()

  Specified by:
    `next` in interface `ContextNodeList`
  Returns:
    The next node in the context node list. null is returned if there are no more nodes in the node list

### count

    public int count()

  Return a count of nodes in the context node list.

  NOTE: this should be implemented with lazy evaluation if possible, since context node lists can be very large, depending on the document.

  Specified by:
    `count` in interface `ContextNodeList`
  Returns:
    Count of nodes in the context node list.

### position

    public int position()

  Return the position of the last node returned by a call to first() or next()

  Specified by:
    `position` in interface `ContextNodeList`
  Returns:
    Node position in node list. 0 is returned if no nodes have been returned. Once first() or next() return null (indicating no more nodes in list) the return will be the position of the last node in the list.

### order

    public int order()

  Return order in which nodes are returned from first()-next()

  Specified by:
    `order` in interface `ContextNodeList`
  Returns:
    DOCUMENT_ORDER or REVERSE_DOCUMENT_ORDER

### getMark

    public ContextListMark getMark()

  Return a marker to a position in a ContextNodeList. This marker can be used later in a call to returnToMark() to return to a particular position in the list.

  Specified by:
    `getMark` in interface `ContextNodeList`
  Returns:
    an opaque marker

### returnToMark

    public Node returnToMark(ContextListMark mark)

  Go to a position in a ContextNodeList previously marked with getMark()

  Specified by:
    `returnToMark` in interface `ContextNodeList`
  Parameters:
    `mark` - mark returned from getMark()
  Returns:
    The node at the mark

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD