public void addNode(BNode node){
  if (nodes.containsKey(node.getId())) {
    log.warning("network already contains a node with identifier " + node.getId());
  }
  nodes.put(node.getId(),node);
  node.setNetwork(this);
  if (node instanceof ChanceNode) {
    chanceNodes.put(node.getId(),(ChanceNode)node);
  }
 else   if (node instanceof UtilityNode) {
    utilityNodes.put(node.getId(),(UtilityNode)node);
  }
 else   if (node instanceof ActionNode) {
    actionNodes.put(node.getId(),(ActionNode)node);
  }
}

public void addNode ( BNode node ) { if ( nodes . containsKey ( node . getId ( ) ) ) { log . warning ( "network already contains a node with identifier " + node . getId ( ) ) ; } nodes . put ( node . getId ( ) , node ) ; node . setNetwork ( this ) ; if ( node instanceof ChanceNode ) { chanceNodes . put ( node . getId ( ) , ( ChanceNode ) node ) ; } else if ( node instanceof UtilityNode ) { utilityNodes . put ( node . getId ( ) , ( UtilityNode ) node ) ; } else if ( node instanceof ActionNode ) { actionNodes . put ( node . getId ( ) , ( ActionNode ) node ) ; } }
adds a new node to the network . note : if the node already exists , it is better to use the " replacenode " method , to avoid warning messages .
