gdl.base
Class SizeListEntry

java.lang.Object
  extended by gdl.base.SizeListEntry

public class SizeListEntry
extends java.lang.Object

A special object that stores temporary elements during the calculation of node sizes in the NodeWeightCalculator: for every node, such a SizeListEntry is instantiated, holding all its direct tree children, the id, and the sum of its own weight and the sum of all its children in the tree.

Author:
Martin Suntinger

Constructor Summary
SizeListEntry(int id, int ownSize)
          Initialize the SizeListEntry Object with its id, and its won size
 
Method Summary
 void addChild(int childId)
          add a temporary child to the entry
 void addToSumOfWeight(int amount)
          adds a value to the entries current sum of weight
 boolean checkIfContainsChild(int child)
           
 java.util.LinkedList getChildren()
           
 int getId()
           
 int getSumOfWeight()
           
 void removeChild(int child)
          Removes a child from the list of node children, that are stored in the current sizeListEntry.
 java.lang.String toString()
          returns a string representation of the listEntry, containing all children and the sum of weight. can be used for debug output
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SizeListEntry

public SizeListEntry(int id,
                     int ownSize)
Initialize the SizeListEntry Object with its id, and its won size

Parameters:
id - the address of the node in the allNodes list and the adjacence matrix
ownSize - the current size of the singe node the entry is for
Method Detail

addChild

public void addChild(int childId)
add a temporary child to the entry

Parameters:
childId - the address of the child node

getChildren

public java.util.LinkedList getChildren()
Returns:
a java.util.LinkedList of all children that are currently listed in this SizeListEntry

getSumOfWeight

public int getSumOfWeight()
Returns:
The current sum of weight of all children of the node the SizeListEntry was created for

addToSumOfWeight

public void addToSumOfWeight(int amount)
adds a value to the entries current sum of weight

Parameters:
amount - the amout to add to the sum of weight of the entry

toString

public java.lang.String toString()
returns a string representation of the listEntry, containing all children and the sum of weight. can be used for debug output

Overrides:
toString in class java.lang.Object

getId

public int getId()
Returns:
the id of the nodeListEntry

checkIfContainsChild

public boolean checkIfContainsChild(int child)
Parameters:
child - the address of child to check on whether it is contained in the entry.
Returns:
true if the entry contains the specified child, false if not

removeChild

public void removeChild(int child)
Removes a child from the list of node children, that are stored in the current sizeListEntry.

Parameters:
child - the address of the child to remove from the entry