}
w.write("\">" + ln);
w.write(
" <NAME>" + IOUtil.mangleXMLString(nodeName)
+ "</NAME>" + ln);
DiscreteDomain domain = (DiscreteDomain) node.getDomain();
if (!node.isUtility()) {
Vector<String> values = domain.getStates();
// valueCache.put(nodeName, values);
for (Iterator j = values.iterator(); j.hasNext();) {
w.write(
" <OUTCOME>"
+ IOUtil.mangleXMLString(
j.next().toString())
+ "</OUTCOME>"
+ ln);
}
}
Object o = node.getProperty("position");
if (o instanceof List) { // implies o != null
String posString = null;
try {
Double xpos = (Double) ((List) o).get(0);
Double ypos = (Double) ((List) o).get(1);
posString = "(" + Math.round(xpos.doubleValue()) + ", "
+ Math.round(ypos.doubleValue()) + ")";
} catch (Exception e) {}
if (posString != null) {
w.write(
" <PROPERTY> position = " + posString
+ " </PROPERTY>" + ln);
}
}
w.write(" </VARIABLE>" + ln);
}
// Dump out the CPTs
w.write(" <!-- Probability Distributions -->" + ln);
for (Iterator i = nodes.iterator(); i.hasNext();) {
BNNode node = (BNNode) i.next();
if (node.isDecision()) {
continue;
} // Decision nodes doesn't have CPT, so skip.
String nodeName = node.getName();
w.write(" <DEFINITION>" + ln); // $NON-NLS-1$
w.write(
" <FOR>" + IOUtil.mangleXMLString(nodeName)
+ "</FOR>" + ln);
Vector<DiscreteDomain> parentDomains = ((TabularFunction) node.getFunction()).getParentsDomains();
for (Iterator j = parentDomains.iterator(); j.hasNext();) {
DiscreteDomain parentDom = (DiscreteDomain) j.next();
String parentName = parentDom.getName();
w.write(
" <GIVEN>"
+ IOUtil.mangleXMLString(parentName)
+ "</GIVEN>" + ln);