コード例 #1
0
 public ParserFunction parseLine(String[] args, PrintStream str) throws ParserException {
   try {
     IFDiscBNNode nd = (IFDiscBNNode) net.getNode(args[0]);
     nd.setValue(Integer.parseInt(args[1]));
   } catch (BNException e) {
     throw new ParserException(
         "Error setting value for node " + args[0] + ": " + e.getMessage());
   }
   return null;
 }
コード例 #2
0
 public ParserFunction parseLine(String[] args, PrintStream str) throws ParserException {
   try { // TODO This is so hacky we need to move to the new command system
     IFDiscBNNode nd = (IFDiscBNNode) net.getNode(args[0]);
     FiniteDiscreteMessage msg = nd.getMarginal();
     for (int i = 0; i < msg.getCardinality(); i++) str.println(msg.getValue(i) + " ");
   } catch (BNException e) {
     throw new ParserException("Error printing marginal : " + e.getMessage());
   }
   return null;
 }