|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.evelopers.unimod.analysis.BooleanSimplifier
This class may be used to simplify formula, to merge set of formulae as conjunction or disjunction, to negate formula.
To check if set of formulae is complete, i.e. conjunction of the set
is identical to true, call
To check if two of formulae are orthogonal, i.e. disjucntion of this
formulae is identical to false, call
BooleanSimplifier bs = BooleanSimplifier.createBooleanSimplifier();
AST node = bs.identicalToTrue(bs.or(formulaeSet));
if (node.getType() == TRUE) {
// Formulae set is complete
} else {
// node contains the conjunction. Disjunction of this node negated and formulaeSet
// will be identical to true
}
BooleanSimplifier bs = BooleanSimplifier.createBooleanSimplifier();
AST node = bs.identicalToFalse(bs.and(Arrays.asList(new AST[] {firstFormula, secondFormula})));
if (node.getType() == FALSE) {
// Formulae are orthogonal
} else {
// node contains the intersection of formulae. Conjunction of formulae and
// negated node will be identical to false.
}
Method Summary | |
antlr.collections.AST |
and(java.util.Set astSet)
Merges astSet to conjunction. |
static BooleanSimplifier |
createBooleanSimplifier()
|
boolean |
equal(antlr.collections.AST f,
antlr.collections.AST g)
Checks is f is equal to g . |
antlr.collections.AST |
identicalToFalse(antlr.collections.AST ast)
Checks if ast is identical to false. |
antlr.collections.AST |
identicalToTrue(antlr.collections.AST ast)
Checks if ast is identical to true. |
antlr.collections.AST |
not(antlr.collections.AST ast)
Negates ast . |
antlr.collections.AST |
or(java.util.Set astSet)
Merges astSet to disjunction. |
antlr.collections.AST |
simplify(antlr.collections.AST ast)
Converts formula to DNF and simplifies it. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static BooleanSimplifier createBooleanSimplifier()
BooleanSimplifier
public antlr.collections.AST and(java.util.Set astSet)
astSet
to conjunction.
astSet
- set to merge
public antlr.collections.AST or(java.util.Set astSet)
astSet
to disjunction.
astSet
- set to merge
public antlr.collections.AST not(antlr.collections.AST ast)
ast
.
ast
- formula to negate.
public antlr.collections.AST simplify(antlr.collections.AST ast) throws InterpreterException
FALSE
.
ast
- formula to simplify.
InterpreterException
- if ast
isn't correctpublic antlr.collections.AST identicalToFalse(antlr.collections.AST ast) throws InterpreterException
ast
is identical to false.
ast
- formula to check
FALSE
if ast
is identical
to false. Simplified formula elsewise.
InterpreterException
public antlr.collections.AST identicalToTrue(antlr.collections.AST ast) throws InterpreterException
ast
is identical to true.
ast
- formula to check
TRUE
if ast
is identical
to true. Simplified formula elsewise.
InterpreterException
public boolean equal(antlr.collections.AST f, antlr.collections.AST g) throws InterpreterException
f
is equal to g
.
true
if f is equal to g.
InterpreterException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |