public bool ttCheckAll(Sentence kbSentence, Sentence querySentence, ArrayList symbols, Model model) { if (symbols.Count == 0) { if (model.isTrue(kbSentence)) { //System.out.println("#"); return model.isTrue(querySentence); } else { //System.out.println("0"); return true; } } else { Symbol symbol = (Symbol)Util.first(symbols); ArrayList rest = Util.rest(symbols); Model trueModel = model.extend(new Symbol(symbol.getValue()), true); Model falseModel = model.extend(new Symbol(symbol.getValue()), false); return (ttCheckAll(kbSentence, querySentence, rest, trueModel) && (ttCheckAll( kbSentence, querySentence, rest, falseModel))); } }
public BinarySentence(string oper, Sentence first, Sentence second) { this.oper = oper; this.first = first; this.second = second; }
public Hashtable getSymbolsIn(Sentence s) { if (s == null) {//empty knowledge bases == null fix this later return new Hashtable(); } object o = s.accept(this,new Hashtable()); Hashtable h = (Hashtable)o; return (Hashtable)s.accept(this, new Hashtable()); }
public bool isFalse(Sentence clause) { Object o = clause.accept(this,null); return (o != null) ? ((bool) o)==false : false; }
// public void print() // { // Iterator i = h.keySet().iterator(); // while (i.hasNext()) // { // Object key = i.next(); // Object value = h.get(key); // System.out.print(key + " = " + value + " "); // //System.out.print (key +" = " +((Boolean)value).booleanValue()); // } // System.out.println(); // } public bool isTrue(Sentence clause) { Object result = clause.accept(this,null); return (result == null) ? false : ((bool) result)==true; }
public bool isUnknown(Sentence clause) { //TODO TEST WELL Object o = clause.accept(this,null); return (o == null) ; }
public UnarySentence(Sentence negated) { this.negated = negated; }