org.sourcejammer.project
Class NodeList

java.lang.Object
  |
  +--org.sourcejammer.project.NodeList

public class NodeList
extends java.lang.Object

A linked and indexed colletion of Nodes. Each node within a NodeList must have a unique name.


Field Summary
private  java.util.Hashtable mhshIndex
           
private  java.util.Hashtable mhshNames
           
private  java.util.Vector mvecNodes
           
 
Constructor Summary
NodeList()
           
 
Method Summary
 void addNode(Node node)
          Adds a node to the list.
 Node[] getContentsAsArray()
          Provided to dump contents of NodeList to an array of Nodes.
 NodeIterator getIterator()
          Returns a NodeIterator for iterating through the contents of this NodeList.
 java.lang.String[] getListNames()
          Returns the names of nodes in the list.
 Node getNode(int index)
          Returns a Node based on it's index value.
 Node getNode(java.lang.String nodeName)
          Returns a Node based on it's unique name.
private  void reindex()
           
 Node removeNode(int index)
          Removes a Node from the NodeList based on it's index value.
 Node removeNode(java.lang.String nodeName)
          Removes a Node from the NodeList based on it's unique name.
 void setContentsFromArray(Node[] nodes)
          Provided to set this NodeList using an array of Nodes.
 int size()
          Returns the number of nodes in the ilst.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mvecNodes

private java.util.Vector mvecNodes

mhshIndex

private java.util.Hashtable mhshIndex

mhshNames

private java.util.Hashtable mhshNames
Constructor Detail

NodeList

public NodeList()
Method Detail

getContentsAsArray

public Node[] getContentsAsArray()
Provided to dump contents of NodeList to an array of Nodes. This array can be passed more easily using SOAP.


setContentsFromArray

public void setContentsFromArray(Node[] nodes)
                          throws NodeExistsException
Provided to set this NodeList using an array of Nodes. Note that calling this method will empty out any previously set nodes from the NodeList.

Throws:
NodeExistsException - if the array contains more than one node with the same nodename.

addNode

public void addNode(Node node)
             throws NodeExistsException
Adds a node to the list.

Parameters:
node - -- the Node to be added.
Throws:
NodeExistsException - if a Node with the same name is already in the NodeList.

getNode

public Node getNode(int index)
             throws NodeDoesNotExistException
Returns a Node based on it's index value.

NodeDoesNotExistException

getNode

public Node getNode(java.lang.String nodeName)
             throws NodeDoesNotExistException
Returns a Node based on it's unique name.

NodeDoesNotExistException

removeNode

public Node removeNode(int index)
                throws NodeDoesNotExistException
Removes a Node from the NodeList based on it's index value.

Parameters:
index - -- index of the Node to be removed.
Returns:
the Node that is being removed.
Throws:
NodeDoesNotExistException - -- if there is no node at the specified index.

removeNode

public Node removeNode(java.lang.String nodeName)
                throws NodeDoesNotExistException
Removes a Node from the NodeList based on it's unique name.

Returns:
the Node that is being removed.
Throws:
NodeDoesNotExistException - -- if there is no node with the specified name.

reindex

private void reindex()

getIterator

public NodeIterator getIterator()
Returns a NodeIterator for iterating through the contents of this NodeList.


size

public int size()
Returns the number of nodes in the ilst.


getListNames

public java.lang.String[] getListNames()
Returns the names of nodes in the list.



Copyright © 2003 Soucejammer project.