Beispiel #1
0
		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)));
			}
		}
Beispiel #2
0
		public BinarySentence(string oper, Sentence first, Sentence second) 
		{
			this.oper = oper;
			this.first = first;
			this.second = second;

		}
Beispiel #3
0
		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());
		}
Beispiel #4
0
		public bool isFalse(Sentence clause) 
		{		
			Object o = clause.accept(this,null);
			return (o != null) ? ((bool) o)==false : false;
		}
Beispiel #5
0
		//		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;
		}
Beispiel #6
0
		public bool isUnknown(Sentence clause) 
		{		//TODO TEST WELL
			Object o = clause.accept(this,null);
			return (o == null) ;
		}
Beispiel #7
0
		public UnarySentence(Sentence negated) 
		{
			this.negated = negated;
		}