private double getWeight(BNNode node) throws ParseException {
List args;
if (node.getFunction() instanceof TabularFunction) {
args = getDiscreteArguments(node);
TabularFunction func = (TabularFunction) node.getFunction();
if (node.isProbabilistic()) {
return ((TabularCPD) func).getProb(args, getEvidence(node));
} else if (node.isDeterministic()) {
Object val = func.getValue(args);
int valIndex = ((DiscreteDomain) func.getDomain()).findState(
(String) val);
if (valIndex == getEvidence(node)) {
return 1;
} else {
return 0;
}
} else {
return 0;
}
} else {
args = getArguments(node);
if (node.isProbabilistic()) {
ICondProbDistrib func = (ICondProbDistrib) node.getFunction();
int evidence = getEvidence(node);
double probDensity = func.getProb(args,
getEvidenceAvarage(node, evidence));
return probDensity * getEvidenceWidth(node, evidence);
} else if (node.isDeterministic()) {