Package ru.ispras.fortress.logic
Class Clause
- java.lang.Object
-
- ru.ispras.fortress.logic.Clause
-
public final class Clause extends java.lang.Object
Clause
represents a clause, which is a set of literals.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Clause.Builder
Clause.Builder
implements a clause builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(int var)
Checks whether the clause contains the specified variable.boolean
contains(Clause clause)
Checks whether the clause contains the specified clause.java.util.Set<java.lang.Integer>
getCommonVars(Clause rhs)
Returns the set of common variables of this clause and the specified one.boolean
getSign(int var)
Returns the sign of the specified variable.java.util.Set<java.lang.Integer>
getUniqueVars(Clause rhs)
Returns the set of variables of the clause that do not belong to the specified clause.java.util.Set<java.lang.Integer>
getVars()
Returns the set of variables of the clause.boolean
isEmpty()
Checks whether the clause is empty.int
size()
Returns the number of literals in the clause.java.lang.String
toString()
java.lang.String
toString(java.lang.String op)
Returns a special string representation of the object with the specified operation code.
-
-
-
Constructor Detail
-
Clause
public Clause(java.util.Map<java.lang.Integer,java.lang.Boolean> literals)
Constructs a clause with the given set of literals.- Parameters:
literals
- the literals.
-
Clause
public Clause()
Constructs an empty clause.
-
Clause
public Clause(Clause rhs)
Constructs a copy of the specified clause.- Parameters:
rhs
- the clause to be copied.
-
-
Method Detail
-
isEmpty
public boolean isEmpty()
Checks whether the clause is empty.- Returns:
true
if the clause is empty;false
otherwise.
-
size
public int size()
Returns the number of literals in the clause.- Returns:
- the size of the clause.
-
getVars
public java.util.Set<java.lang.Integer> getVars()
Returns the set of variables of the clause.- Returns:
- the variables of the clause.
-
getCommonVars
public java.util.Set<java.lang.Integer> getCommonVars(Clause rhs)
Returns the set of common variables of this clause and the specified one.- Parameters:
rhs
- the clause whose variables to be considered.- Returns:
- the set of common variables.
-
getUniqueVars
public java.util.Set<java.lang.Integer> getUniqueVars(Clause rhs)
Returns the set of variables of the clause that do not belong to the specified clause.- Parameters:
rhs
- the clause whose variables to be considered.- Returns:
- the set of unique variables.
-
getSign
public boolean getSign(int var)
Returns the sign of the specified variable.- Parameters:
var
- the variable.- Returns:
- true iff the variable is negated.
-
contains
public boolean contains(int var)
Checks whether the clause contains the specified variable.- Parameters:
var
- the variable to be checked.- Returns:
- true iff the clause contains the variable.
-
contains
public boolean contains(Clause clause)
Checks whether the clause contains the specified clause.- Parameters:
clause
- the clause to be checked.- Returns:
- true iff the clause contains the variable.
-
toString
public java.lang.String toString(java.lang.String op)
Returns a special string representation of the object with the specified operation code.- Parameters:
op
- The operation code.- Returns:
- The object's string representation for the specified operation code.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-