Package ru.ispras.fortress.logic
Class NormalForm
- java.lang.Object
-
- ru.ispras.fortress.logic.NormalForm
-
public final class NormalForm extends java.lang.Object
This class represents a normal form, which is a set of clauses. The representation can be interpreted as either DNF or CNF.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NormalForm.Builder
NormalForm.Builder
implements a clause builder.static class
NormalForm.Type
This enumeration contains the type of the normal form.
-
Constructor Summary
Constructors Constructor Description NormalForm(NormalForm.Type type)
Constructs the empty normal form of the specified type.NormalForm(NormalForm.Type type, java.util.Collection<Clause> clauses)
Constructs the normal form of the specified type consisting of the specified clauses.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<Clause>
getClauses()
Returns the clauses of the normal form.NormalForm.Type
getType()
Returns the type of the normal form (DNF
orCNF
).boolean
isEmpty()
Checks whether the normal form is empty.int
size()
Returns the number of clauses in the normal form.java.lang.String
toString()
Returns the string representation of the normal form.
-
-
-
Constructor Detail
-
NormalForm
public NormalForm(NormalForm.Type type, java.util.Collection<Clause> clauses)
Constructs the normal form of the specified type consisting of the specified clauses.- Parameters:
type
- the type of the form.clauses
- the clauses of the form.
-
NormalForm
public NormalForm(NormalForm.Type type)
Constructs the empty normal form of the specified type.- Parameters:
type
- the type of the form.
-
-
Method Detail
-
getType
public NormalForm.Type getType()
Returns the type of the normal form (DNF
orCNF
).- Returns:
- the type of the form.
-
isEmpty
public boolean isEmpty()
Checks whether the normal form is empty.- Returns:
true
if the normal form is empty;false
otherwise.
-
size
public int size()
Returns the number of clauses in the normal form.- Returns:
- the size of the form.
-
getClauses
public java.util.List<Clause> getClauses()
Returns the clauses of the normal form.- Returns:
- the clauses of the form.
-
toString
public java.lang.String toString()
Returns the string representation of the normal form.- Overrides:
toString
in classjava.lang.Object
- Returns:
- the string representing the form.
-
-