ArrayList<Node> nodes = net.getNodesCopy();
int size = nodes.size();
for (int i = 0; i < size; i++) {
Node node = (Node) nodes.get(i);
TreeVariable treeVariable = (TreeVariable) node;
DefaultMutableTreeNode treeNode = null;
//by young
if( getTextOutputMode() == TEXTOUTPUTMODEMODE_USE_NAME )
treeNode = findUserObject(node.getName(), root);
else
if( getTextOutputMode() == TEXTOUTPUTMODEMODE_USE_DESC )
treeNode = findUserObject(node.getDescription(), root);
if (treeNode == null)
{
if( getTextOutputMode() == TEXTOUTPUTMODEMODE_USE_NAME )
treeNode = new DefaultMutableTreeNode(node.getName());
else
if( getTextOutputMode() == TEXTOUTPUTMODEMODE_USE_DESC )
treeNode = new DefaultMutableTreeNode(node.getDescription());
root.add(treeNode);
}
objectsMap.put(treeNode, node);
int statesSize = node.getStatesSize();
Debug.println("new tree node "+ treeNode.toString() );
//by Young 2011
String strEngine = EDB.This().get("ROOT.NET_INFO.CURRENT_ENGINE").getData();
EDBUnit BEL = EDB.This().get("ROOT.ENGINES." + strEngine + ".NODES." + node.getName() +".BEL");
EDBUnit type = EDB.This().get("ROOT.ENGINES." + strEngine + ".NODES." + node.getName() +".INFO.TYPE");
EDBUnit EVIDENCE = EDB.This().get("ROOT.ENGINES." + strEngine + ".NODES." + node.getName() +".EVIDENCE");
EDBUnit EVIDENCE2 = EDB.This().get("ROOT.NODES." + node.getName() +".EVIDENCE");
String label;
if( EVIDENCE2 != null && EVIDENCE2.hasChildren() ){
label = "EVIDENCE" + ": " + EVIDENCE2.getData();
treeNode.add(new DefaultMutableTreeNode(label));
}else if( EVIDENCE != null && EVIDENCE.hasChildren() ){
label = "EVIDENCE" + ": " + EVIDENCE.getData();
treeNode.add(new DefaultMutableTreeNode(label));
}else{
if (treeVariable.getType() == Node.PROBABILISTIC_NODE_TYPE) {
for (int j = 0; j < statesSize; j++) {
//BEL.print("BEL ");
if( treeVariable.hasEvidence() == true ){
label = node.getStateAt(j) + ": " + nf.format(treeVariable.getMarginalAt(j) * 100.0);
}
else{
BEL = BEL.getNext();
label = node.getStateAt(j) + ": " + nf.format(BEL.getDataByDouble().floatValue() * 100.0);
}