use of java.util.ListIterator in project processdash by dtuma.
the class CsvNodeDataImporter method tweakNodes.
private void tweakNodes(List nodes) {
if (nodes == null)
return;
if (nodes.size() > 2) {
// remove top-down estimates from non-leaf nodes
ListIterator i = nodes.listIterator(nodes.size());
WBSNode nextNode = (WBSNode) i.previous();
tweakInitialsData(nextNode);
while (i.hasPrevious()) {
WBSNode node = (WBSNode) i.previous();
int nodeIndent = node.getIndentLevel();
int nextIndent = nextNode.getIndentLevel();
if (nodeIndent < nextIndent) {
// this node is a parent node.
node.setAttribute(TIME_PER_PERSON_ATTR, null);
node.setAttribute(NUM_PEOPLE_ATTR, null);
} else {
// this node is a leaf node.
tweakInitialsData(node);
}
node.setAttribute(INITIALS_TEMP, null);
node.setAttribute(DURATION_TEMP, null);
nextNode = node;
}
}
}
Aggregations