com.teamkonzept.dom4jb.dom
Class NodeList

java.lang.Object
  |
  +--com.teamkonzept.dom4jb.dom.NodeList
All Implemented Interfaces:
NodeList
Direct Known Subclasses:
DescendantAxis, Node

public class NodeList
extends Object
implements NodeList


Field Summary
static NodeList EMPTY
           
protected static int initialCapacity
           
protected  Node[] nodeData
          The array buffer into which the elements of the NodeList are stored.
protected  ContentIterator nodeIterator
           
protected  Node parent
          The parent node of all nodes stored in this nodelist
protected  int size
          The size of the NodeList (the number of elements it contains).
 
Constructor Summary
NodeList(ContentIterator iterator)
          Constructs an node list
NodeList(Node parent)
           
NodeList(Node parent, ContentIterator iterator)
          Constructs an node list
 
Method Summary
 boolean add(Node o)
          Appends the specified element to the end of this list.
 void clear()
          Removes all of the elements from this list.
 void ensureCapacity(int minCapacity)
          Increases the capacity of this NodeList instance, if necessary, to ensure that it can hold at least the number of elements specified by the minimum capacity argument.
 Node get(int index)
          Returns the indexth item in the collection.
 int getLength()
          Returns the number of elements in this list.
 Node getParentNode()
          The parent of this nodes.
 boolean isEmpty()
          Tests if this list has no elements.
 Node item(int index)
          Returns the indexth item in the collection.
protected  void setIterator(ContentIterator iterator)
           
 void setParentNode(Node parent)
           
 int size()
          The number of nodes in the list.
 void trimToSize()
          Trims the capacity of this NodeList instance to be the list's current size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY

public static final NodeList EMPTY

initialCapacity

protected static final int initialCapacity
See Also:
Constant Field Values

nodeData

protected Node[] nodeData
The array buffer into which the elements of the NodeList are stored. The capacity of the ArrayList is the length of this array buffer.


nodeIterator

protected ContentIterator nodeIterator

size

protected int size
The size of the NodeList (the number of elements it contains).


parent

protected Node parent
The parent node of all nodes stored in this nodelist

Constructor Detail

NodeList

public NodeList(Node parent)

NodeList

public NodeList(ContentIterator iterator)
Constructs an node list


NodeList

public NodeList(Node parent,
                ContentIterator iterator)
Constructs an node list

Method Detail

trimToSize

public void trimToSize()
Trims the capacity of this NodeList instance to be the list's current size. An application can use this operation to minimize the storage of an NodeList instance.


ensureCapacity

public void ensureCapacity(int minCapacity)
Increases the capacity of this NodeList instance, if necessary, to ensure that it can hold at least the number of elements specified by the minimum capacity argument.

Parameters:
minCapacity - the desired minimum capacity.

getLength

public int getLength()
Returns the number of elements in this list.

Specified by:
getLength in interface NodeList
Returns:
the number of elements in this list.

size

public int size()
The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive.


isEmpty

public boolean isEmpty()
Tests if this list has no elements.

Returns:
true if this list has no elements; false otherwise.

get

public Node get(int index)
Returns the indexth item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null.

Parameters:
index - Index into the collection.
Returns:
The node at the indexth position in the NodeList, or null if that is not a valid index.

item

public Node item(int index)
Returns the indexth item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null.

Specified by:
item in interface NodeList
Parameters:
index - Index into the collection.
Returns:
The node at the indexth position in the NodeList, or null if that is not a valid index.

add

public boolean add(Node o)
Appends the specified element to the end of this list.

Parameters:
o - element to be appended to this list.
Returns:
true (as per the general contract of Collection.add).

clear

public void clear()
Removes all of the elements from this list. The list will be empty after this call returns.


setParentNode

public void setParentNode(Node parent)

getParentNode

public Node getParentNode()
The parent of this nodes. All nodes, except Attr, Document, DocumentFragment, Entity, and Notation may have a parent. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, this is null.


setIterator

protected void setIterator(ContentIterator iterator)


Copyright © 2001-2003 Team-Konzept GmbH & CO KG. All Rights Reserved.