|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectFormula
public class Formula
Formula class holds a vector of clauses, a vector of booleans, a vector of clause numbers, and a vector of integers. The booleans correspond to the clauses,and if they are true or false. The clause numbers are which clauses will be true when certain variables are true. The integers correspond to the number of times each term occurs in the formula.
| Constructor Summary | |
|---|---|
Formula(Formula f)
Constructor that creates a copy of f. |
|
Formula(java.lang.String inputFileName)
Constructor for class Formula. |
|
| Method Summary | |
|---|---|
void |
add(Clause c)
Add a clause to the formula. |
java.util.Vector |
getClauses()
Returns the vector of clauses. |
java.util.Vector |
getFormula()
Returns the vector of clauses. |
java.lang.String |
getInputFile()
|
int |
getNumVars()
|
double[] |
getOccurrences()
Returns the occurrences of each variable, in the form of a vector. |
boolean |
hasEmptyClause()
Returns true if there is an empty clause. |
boolean |
hasFalseClause(Assignment partial)
Returns false if any clause can't be satisfied given the partial assignment. |
boolean |
isEmpty()
Returns true if the formula is empty. |
boolean |
satisfied(Assignment partial)
Checks to see if the formula is satisfied by the given partial assignment. |
void |
setIndex(int pos,
int clauseNum)
Sets a clause number to a spot in the index vector. |
void |
setOccurred(Assignment pa)
Counts the occurrences of each term in the formula. |
java.lang.String |
toString()
Makes the formula into a string. |
int |
unitClause(Assignment pa)
Checks for unit clauses in the formula. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait,
wait |
| Constructor Detail |
|---|
public Formula(java.lang.String inputFileName)
throws java.io.FileNotFoundException
numClauses - the number of
clausesnumVars - the number of variables
java.io.FileNotFoundExceptionpublic Formula(Formula f)
f - is another formula| Method Detail |
|---|
public int getNumVars()
public java.lang.String getInputFile()
public void add(Clause c)
c - the clause to be added to the
vector of clauses.
public void setIndex(int pos,
int clauseNum)
pos - the position in the
vector.clauseNum - the clause number to be inserted.public java.util.Vector getClauses()
public java.util.Vector getFormula()
public boolean isEmpty()
public boolean hasEmptyClause()
public boolean satisfied(Assignment partial)
partial - the partial assignment to
be checked.
public boolean hasFalseClause(Assignment partial)
partial - the assignment to be
checked.
public void setOccurred(Assignment pa)
pa - the current partial
assignment.public double[] getOccurrences()
public int unitClause(Assignment pa)
pa - the current partial assignment
public java.lang.String toString()
toString in class
java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||