org.palo.api
Class ElementNode

java.lang.Object
  extended by org.palo.api.ElementNode

public class ElementNode
extends java.lang.Object

ElementNode

ElementNodes are used to construct a tree of consolidations for a given dimension. Since elements can be consolidated multiple times, it is not practicable to use them as is for representing tree-nodes in the consolidation-hierarchy instead ElementNodes are used. Each element-node wraps an element where a single element can be wrapped in multiple ElementNodes. The wrapped element can be retrieved by invoking getElement().

Version:
$Id: ElementNode.html,v 1.30 2009/07/09 11:01:46 ArndHouben Exp $

Constructor Summary
ElementNode(Element element)
          Constructs a new ElementNode
ElementNode(Element element, Consolidation consolidation)
          Constructs a new ElementNode
ElementNode(Element element, Consolidation consolidation, int index)
          Constructs a new ElementNode
 
Method Summary
 void addChild(ElementNode child)
          Adds a child to this ElementNode.
 boolean equals(java.lang.Object obj)
           
 ElementNode[] getChildren()
          Returns the children of this ElementNode.
 Consolidation getConsolidation()
          Returns the Consolidation of this instance.
 int getDepth()
          Returns the depth of this ElementNode in the consolidation hierarchy.
 Element getElement()
          Returns the wrapped Element.
 int getIndex()
          Returns the optional index of this instance or -1 if no index was set.
 java.lang.String getName()
           
 ElementNode getParent()
          Returns the parent ElementNode or null.
 boolean hasChildren()
          Returns whether this ElementNode has any children.
 int hashCode()
           
 void removeChild(ElementNode child)
          Removes a child from this ElementNode.
 void removeChildren()
          Removes all children from this ElementNode.
 void setName(java.lang.String name)
           
 void setParent(ElementNode parent)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ElementNode

public ElementNode(Element element)
Constructs a new ElementNode

Parameters:
element - the Element to wrap.

ElementNode

public ElementNode(Element element,
                   Consolidation consolidation)
Constructs a new ElementNode

Parameters:
element - the Element to wrap.
consolidation - the Consolidation of this node.

ElementNode

public ElementNode(Element element,
                   Consolidation consolidation,
                   int index)
Constructs a new ElementNode

Parameters:
element - the Element to wrap.
consolidation - the Consolidation of this node.
index - index in parent (optional)
Method Detail

getName

public final java.lang.String getName()

setName

public final void setName(java.lang.String name)

getIndex

public final int getIndex()
Returns the optional index of this instance or -1 if no index was set.

Parameters:
the - index of this instance or -1 if none was set

getElement

public final Element getElement()
Returns the wrapped Element.

Returns:
the wrapped Element.

getConsolidation

public final Consolidation getConsolidation()
Returns the Consolidation of this instance.

Returns:
the Consolidation of this instance.

setParent

public final void setParent(ElementNode parent)

getParent

public final ElementNode getParent()
Returns the parent ElementNode or null.

Returns:
the parent ElementNode or null.

getDepth

public final int getDepth()
Returns the depth of this ElementNode in the consolidation hierarchy.

Returns:
the depth of this ElementNode

addChild

public final void addChild(ElementNode child)
Adds a child to this ElementNode. Note: This is an internal method and it is not required to invoke it under most circumstances.

Parameters:
child - the child to add.

removeChild

public final void removeChild(ElementNode child)
Removes a child from this ElementNode. Note: This is an internal method and it is not required to invoke it under most circumstances.

Parameters:
child - the child to remove.

removeChildren

public final void removeChildren()
Removes all children from this ElementNode. Note: This is an internal method and it is not required to invoke it under most circumstances.


getChildren

public ElementNode[] getChildren()
Returns the children of this ElementNode.

Returns:
the children of this ElementNode.

hasChildren

public boolean hasChildren()
Returns whether this ElementNode has any children.

Returns:
whether this ElementNode has any children.

toString

public final java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public final boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public final int hashCode()
Overrides:
hashCode in class java.lang.Object