-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDefClauseKB.java
48 lines (37 loc) · 1.05 KB
/
DefClauseKB.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import java.util.Iterator;
import java.util.Vector;
/*
* a knowledge base that consists of definite clauses
*
*/
public class DefClauseKB
{
public Vector<DefiniteClause> theClauses = new Vector<DefiniteClause>();
public Vector<DefiniteClause> getDefClauses()
{
return theClauses;
}
public Iterator<DefiniteClause> getIter() {
return theClauses.iterator();
}
public void print() {
Iterator<DefiniteClause> iter = this.getIter();
System.out.println("Knowledge base: ");
while(iter.hasNext()) {
DefiniteClause next = iter.next();
next.print();
System.out.println();
}
}
// public boolean contains(CNFSubClause newS)
// {
// for(int i = 0; i < theClauses.size(); i ++)
// {
// if(theClauses.get(i).getLiterals().equals(newS.getLiterals()))
// {
// return true;
// }
// }
// return false;
// }
}