Search in sources :

Example 1 with ComplexityVisitor

use of de.neemann.digital.analyse.expression.ComplexityVisitor in project Digital by hneemann.

the class QuineMcCluskeyExamTest method testMultipleSolutions.

public void testMultipleSolutions() throws ExpressionException, FormatterException {
    ExpressionListenerStore results = new ExpressionListenerStore(null);
    new MinimizerQuineMcCluskeyExam().minimize(Variable.vars(4), new BoolTableByteArray(new byte[] { 2, 0, 0, 0, 1, 2, 0, 0, 1, 1, 2, 0, 1, 1, 1, 2 }), "Y", results);
    assertEquals(4, results.getResults().size());
    int compl = -1;
    for (ExpressionListenerStore.Result r : results.getResults()) {
        assertEquals("Y", r.getName());
        int c = r.getExpression().traverse(new ComplexityVisitor()).getComplexity();
        if (compl < 0)
            compl = c;
        assertEquals(compl, c);
    }
}
Also used : ComplexityVisitor(de.neemann.digital.analyse.expression.ComplexityVisitor) MinimizerQuineMcCluskeyExam(de.neemann.digital.analyse.MinimizerQuineMcCluskeyExam) ExpressionListenerStore(de.neemann.digital.gui.components.table.ExpressionListenerStore)

Aggregations

MinimizerQuineMcCluskeyExam (de.neemann.digital.analyse.MinimizerQuineMcCluskeyExam)1 ComplexityVisitor (de.neemann.digital.analyse.expression.ComplexityVisitor)1 ExpressionListenerStore (de.neemann.digital.gui.components.table.ExpressionListenerStore)1