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

## nu.xom
Class Nodes

    Object
      nu.xom.Nodes

    public final class Nodes

extends Object

Implements a list of nodes for traversal purposes. Changes to the document from which this list was generated are not reflected in this list, nor are changes to the list reflected in the document. Changes to the individual `Node` objects in the list and the document are reflected in the other one.

There is no requirement that the list not contain duplicates, or that all the members come from the same document. It is simply a list of nodes.

Version:
  1.1b4
Author:
  Elliotte Rusty Harold

Constructor Summary
`Nodes()` Creates an empty node list.
`Nodes(Node node)` Creates a node list containing a single node.

Method Summary
`void` | `append(Node node)` Adds a node at the end of this list.
`boolean` | `contains(Node node)` Determines whether a node is contained in this list.
`Node` | `get(int index)` Returns the indexth node in the list.
`void` | `insert(Node node, int index)` Inserts a node at the indexth position in the list.
`Node` | `remove(int index)` Removes the indexthnode in the list.
`int` | `size()` Returns the number of nodes in the list.

Methods inherited from class Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Nodes

    public Nodes()

  Creates an empty node list.

### Nodes

    public Nodes(Node node)

  Creates a node list containing a single node.

  Parameters:
    `node` - the node to insert in the list
  Throws:
    `NullPointerException` - if `node` is null

Method Detail

### size

    public int size()

  Returns the number of nodes in the list. This is guaranteed to be non-negative.

  Returns:
    the number of nodes in the list

### get

    public Node get(int index)

  Returns the indexth node in the list. The first node has index 0. The last node has index `size()-1`.

  Parameters:
    `index` - the node to return
  Returns:
    the node at the specified position
  Throws:
    `IndexOutOfBoundsException` - if `index` is negative or greater than or equal to the size of the list

### remove

    public Node remove(int index)

  Removes the indexthnode in the list. Subsequent nodes have their indexes reduced by one.

  Parameters:
    `index` - the node to remove
  Returns:
    the node at the specified position
  Throws:
    ``IndexOutOfBoundsException`` - if index is negative or greater than or equal to the size of the list

### insert

    public void insert(Node node,
                       int index)

  Inserts a node at the indexth position in the list. Subsequent nodes have their indexes increased by one.

  Parameters:
    `node` - the node to insert
    `index` - the position at which to insert the node
  Throws:
    `IndexOutOfBoundsException` - if `index` is negative or strictly greater than the size of the list
    `NullPointerException` - if `node` is null

### append

    public void append(Node node)

  Adds a node at the end of this list.

  Parameters:
    `node` - the node to add to the list
  Throws:
    `NullPointerException` - if `node` is null

### contains

    public boolean contains(Node node)

  Determines whether a node is contained in this list.

  Parameters:
    `node` - the node to search for
  Returns:
    true if this list contains the specified node; false otherwise

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

Copyright 2002-2006 Elliotte Rusty Harold
elharo@metalab.unc.edu