for (Iterator itr = m_in2count.entrySet().iterator(); itr.hasNext();) {
Map.Entry entry = (Map.Entry)itr.next();
Coordinate coord = (Coordinate)entry.getKey();
Integer count = (Integer)entry.getValue();
OptDirectedXYNode node = (OptDirectedXYNode)getGraphBuilder().buildNode();
node.setCoordinate(coord);
//set the out degree (in count means => out degree)
node.setOutDegree(count.intValue());
//get the in degree (out count) from the out map, if no entry, set to 0
count = (Integer)m_out2count.get(coord);
if (count != null) node.setInDegree(count.intValue());
else node.setInDegree(0);
getGraphBuilder().addNode(node);
//set map value to be node instead of count
entry.setValue(node);
}
//create only nodes that are not in the in set
for (Iterator itr = m_out2count.entrySet().iterator(); itr.hasNext();) {
Map.Entry entry = (Map.Entry)itr.next();
Coordinate coord = (Coordinate)entry.getKey();
Integer count = (Integer)entry.getValue();
//look for the node in the in set, if not there, it means that the
// node is never an in node => out degree = 0
OptDirectedXYNode node = (OptDirectedXYNode)m_in2count.get(coord);
if (node == null) {
node = (OptDirectedXYNode)getGraphBuilder().buildNode();
node.setCoordinate(coord);
node.setOutDegree(0);
node.setInDegree(count.intValue());
getGraphBuilder().addNode(node);
}
//else do nothing, the node was already set when processing in set