antsnest.datastructure
Class AntAttributeList

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

public class AntAttributeList
extends Object
implements Serializable

Holds a collection of attributes in their relevant positions

Author:
Chris Clohosy
See Also:
AntAttribute, Serialized Form

Constructor Summary
AntAttributeList()
          Constructs a new list
 
Method Summary
 void addAttribute(AntAttribute attribute)
          Adds an attribute to the end of the list
 void addAttribute(AntAttribute attribute, int position)
          Adds an attribute at a specified position
 void changeAttribute(AntAttribute attribute)
          Changes an attribute in the list
 AntAttribute getAttribute(int position)
          Gets the attribute at the required position
 AntAttribute getAttribute(String name)
          Gets the attribute with the required name
 int getLength()
          Gets the length of the list
 int indexOf(AntAttribute attribute)
          Gets the index of a specified attribute
 void removeAttribute(AntAttribute attribute)
          Removes an attribute from a specified position
 void removeAttribute(int position)
          Removes an attribute from a specified position
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AntAttributeList

public AntAttributeList()
Constructs a new list

Method Detail

getLength

public int getLength()
Gets the length of the list

Returns:
an int, the length

getAttribute

public AntAttribute getAttribute(int position)
Gets the attribute at the required position

Parameters:
position - the required position
Returns:
an AntAttribute, the required attribute

getAttribute

public AntAttribute getAttribute(String name)
Gets the attribute with the required name

Parameters:
name - the required attribute's name
Returns:
an AntAttribute, the required attribute

addAttribute

public void addAttribute(AntAttribute attribute,
                         int position)
Adds an attribute at a specified position

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

addAttribute

public void addAttribute(AntAttribute attribute)
Adds an attribute to the end of the list

Parameters:
attribute - the attribute to add

removeAttribute

public void removeAttribute(AntAttribute attribute)
Removes an attribute from a specified position

Parameters:
attribute - the attribute to remove

removeAttribute

public void removeAttribute(int position)
Removes an attribute from a specified position

Parameters:
position - the position of the attribute to remove

changeAttribute

public void changeAttribute(AntAttribute attribute)
Changes an attribute in the list

Parameters:
attribute - the new version of an attribute

indexOf

public int indexOf(AntAttribute attribute)
Gets the index of a specified attribute

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