antsnest.datastructure
Class AntNodeList

java.lang.Object
  extended by antsnest.datastructure.AntNodeList
All Implemented Interfaces:
Serializable

public class AntNodeList
extends Object
implements Serializable

Holds a collection of nodes in their relevant position

Author:
Chris Clohosy
See Also:
AntNode, Serialized Form

Constructor Summary
AntNodeList()
          Constructs a new list
 
Method Summary
 void addNode(AntNode node)
          Adds a node to the end of this node
 void addNode(AntNode node, int position)
          Adds a node at a specified position
 int getLength()
          Gets the length of the list
 AntNode getNode(int position)
          Gets the node at the required position
 int indexOf(AntNode node)
          Gets the index of a specified node
 void removeNode(AntNode node)
          Removes a node from a specified position
 void removeNode(int position)
          Removes a node from a specified position
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AntNodeList

public AntNodeList()
Constructs a new list

Method Detail

getLength

public int getLength()
Gets the length of the list

Returns:
an int, the length

getNode

public AntNode getNode(int position)
Gets the node at the required position

Parameters:
position - the required position
Returns:
an AntNode, the required node

addNode

public void addNode(AntNode node,
                    int position)
Adds a node at a specified position

Parameters:
node - the node to add
position - the position to add it

addNode

public void addNode(AntNode node)
Adds a node to the end of this node

Parameters:
node - the node to add

removeNode

public void removeNode(AntNode node)
Removes a node from a specified position

Parameters:
node - the node to remove

removeNode

public void removeNode(int position)
Removes a node from a specified position

Parameters:
position - the position of the node to remove

indexOf

public int indexOf(AntNode node)
Gets the index of a specified node

Parameters:
node - the specified node
Returns:
an int, the index