antsnest.datastructure
Class DefaultAntElement

java.lang.Object
  extended by antsnest.datastructure.DefaultAntNode
      extended by antsnest.datastructure.DefaultAntElement
All Implemented Interfaces:
AntElement, AntNode, Serializable

public class DefaultAntElement
extends DefaultAntNode
implements AntElement

Implementation of AntElement

Author:
Chris Clohosy
See Also:
AntElement, Serialized Form

Constructor Summary
DefaultAntElement()
          Constructs a new element
DefaultAntElement(Definition definition)
          Constructs a new element from a definition
 
Method Summary
 void addAttribute(AntAttribute attribute)
          Adds an attribute to the end of the node
 void addAttribute(AntAttribute attribute, int position)
          Adds an attribute to this node
 void addNode(AntNode node, int position)
          Adds a node to this node
 void changeAttribute(AntAttribute attribute)
          Changes an attribute in the list
 AntNode cloneNode(IDPool idPool)
          Gets a clone of this node
 void fireChange(ChangeEvent event)
          Alerts all interested parties that a change has occured
 String getID()
          Get the ID of this element
 String getTaskname()
          Get the taskname of this element
 void introduceAttributes()
          Lets all the node's attributes discover the status of each other
 boolean isProperty()
          Finds out whether this element is a property
 void removeNode(AntNode node)
          Removes a node from this node
 void removeNode(int position)
          Removes a node from this node
 void setID(String id)
          Set the ID of this element
 void setTaskname(String taskname)
          Set the taskname of this element
 String toString()
          Provides a string representation of this element
 
Methods inherited from class antsnest.datastructure.DefaultAntNode
addNode, equals, getAttribute, getAttribute, getAttributeSize, getData, getDescription, getIDPool, getName, getNode, getNodeID, getNodeSize, getNodeText, getParent, getType, getTypeAt, indexOfAttribute, indexOfNode, moveAttribute, moveNode, removeAttribute, removeAttribute, setData, setDescription, setIDPool, setName, setNodeID, setParent
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface antsnest.datastructure.AntNode
addNode, getAttribute, getAttribute, getAttributeSize, getData, getDescription, getIDPool, getName, getNode, getNodeID, getNodeSize, getNodeText, getParent, getType, getTypeAt, indexOfAttribute, indexOfNode, moveAttribute, moveNode, removeAttribute, removeAttribute, setData, setDescription, setIDPool, setName, setNodeID, setParent
 

Constructor Detail

DefaultAntElement

public DefaultAntElement()
Constructs a new element


DefaultAntElement

public DefaultAntElement(Definition definition)
Constructs a new element from a definition

Parameters:
definition - the definition of a task or type
Method Detail

getID

public String getID()
Get the ID of this element

Specified by:
getID in interface AntElement
Returns:
a String, the ID

setID

public void setID(String id)
Set the ID of this element

Specified by:
setID in interface AntElement
Parameters:
id - the new ID

getTaskname

public String getTaskname()
Get the taskname of this element

Specified by:
getTaskname in interface AntElement
Returns:
a String, the taskname

setTaskname

public void setTaskname(String taskname)
Set the taskname of this element

Specified by:
setTaskname in interface AntElement
Parameters:
taskname - the new taskname

isProperty

public boolean isProperty()
Finds out whether this element is a property

Specified by:
isProperty in interface AntElement
Returns:
a boolean, whether this element is a property

addAttribute

public void addAttribute(AntAttribute attribute,
                         int position)
Adds an attribute to this node

Specified by:
addAttribute in interface AntNode
Overrides:
addAttribute in class DefaultAntNode
Parameters:
attribute - the attribute to add
position - the index to place the attribute

addAttribute

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

Specified by:
addAttribute in interface AntNode
Overrides:
addAttribute in class DefaultAntNode
Parameters:
attribute - the attribute to add

changeAttribute

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

Specified by:
changeAttribute in interface AntNode
Overrides:
changeAttribute in class DefaultAntNode
Parameters:
attribute - the new version of an attribute

addNode

public void addNode(AntNode node,
                    int position)
             throws CannotAddNodeException
Adds a node to this node

Specified by:
addNode in interface AntNode
Overrides:
addNode in class DefaultAntNode
Parameters:
node - the node to add
position - the the index where to place the node
Throws:
CannotAddNodeException - if the node is not allowed to be added

removeNode

public void removeNode(AntNode node)
Removes a node from this node

Specified by:
removeNode in interface AntNode
Overrides:
removeNode in class DefaultAntNode
Parameters:
node - the node to remove

removeNode

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

Specified by:
removeNode in interface AntNode
Overrides:
removeNode in class DefaultAntNode
Parameters:
position - the index of the node to remove

fireChange

public void fireChange(ChangeEvent event)
Alerts all interested parties that a change has occured

Parameters:
event - the event that encapsulates information about the change

toString

public String toString()
Provides a string representation of this element

Overrides:
toString in class Object
Returns:
a String, the string representation

introduceAttributes

public void introduceAttributes()
Lets all the node's attributes discover the status of each other

Specified by:
introduceAttributes in interface AntElement

cloneNode

public AntNode cloneNode(IDPool idPool)
Gets a clone of this node

Specified by:
cloneNode in interface AntNode
Specified by:
cloneNode in class DefaultAntNode
Parameters:
idPool - an ID pool to use
Returns:
an AntNode, the cloned node