public static DialogueKBFormula processGoalExpression(DialogueKBFormula f, String goalVarName) throws Exception { HashMap<DialogueKBFormula, DialogueKBFormula> subs = new HashMap<DialogueKBFormula, DialogueKBFormula>(); subs.put(DialogueKBFormula.create(".", null), DialogueKBFormula.create(goalVarName, null)); return f.substitute(subs); }
public static DialogueOperatorEffect createIncrementForVariable( String var, DialogueKBFormula increment) throws Exception { DialogueKBFormula varf = DialogueKBFormula.create(var, null); Collection<DialogueKBFormula> args = new ArrayList<DialogueKBFormula>(); args.add(varf); args.add(increment); DialogueKBFormula incf = DialogueKBFormula.create("+", args); return DialogueOperatorEffect.createAssignment(varf, incf, false); }
public static DialogueOperatorEffect createIncrementForVariable(String var, Number val) throws Exception { DialogueKBFormula increment = DialogueKBFormula.create(val + "", null); return DialogueOperatorEffect.createIncrementForVariable(var, increment); }
public static DialogueOperatorEffect createAssignment(String varName, Object value) throws Exception { return createAssignment(DialogueKBFormula.create(varName, null), value, true); }