### Question:
FormulaEvaluator { public static int evaluate(Formula f, Boolean[] s) { int numFalseClauses = 0; boolean clauseIsNegative = true; for (Clause c : f.getClauses()) { clauseIsNegative = true; for (Literal l : c.getLiterals()) { boolean x = s[l.getIndex()]; if (l.isNeg()) { x = !x; } if (x) { clauseIsNegative = false; break; } } if (clauseIsNegative) { numFalseClauses++; } } return numFalseClauses; } FormulaEvaluator(Formula formula); static int evaluate(Formula f, Boolean[] s); double evaluate(Formula f, Integer id);  }### Answer:
@Test public void test() { ArrayList<Clause> clauses = new ArrayList<Clause>(); clauses.add(new Clause(new Literal[] { new Literal(0, false), new Literal(1, true), new Literal(2, true) })); clauses.add(new Clause(new Literal[] { new Literal(0, true), new Literal(1, false), new Literal(2, true) })); clauses.add(new Clause(new Literal[] { new Literal(0, true), new Literal(1, true), new Literal(2, false) })); Formula f = new Formula(null, clauses); assertEquals(0, FormulaEvaluator.evaluate(f, new Boolean[] { false, false, false })); assertEquals(0, FormulaEvaluator.evaluate(f, new Boolean[] { true, true, true })); assertEquals(0, FormulaEvaluator.evaluate(f, new Boolean[] { true, false, false })); assertEquals(0, FormulaEvaluator.evaluate(f, new Boolean[] { false, true, false })); assertEquals(0, FormulaEvaluator.evaluate(f, new Boolean[] { false, false, true })); assertEquals(1, FormulaEvaluator.evaluate(f, new Boolean[] { true, true, false })); assertEquals(1, FormulaEvaluator.evaluate(f, new Boolean[] { false, true, true })); assertEquals(1, FormulaEvaluator.evaluate(f, new Boolean[] { true, false, true })); FormulaEvaluator formulaEvaluator = new FormulaEvaluator(f); printObjectiveValues(formulaEvaluator, f, new Boolean[] { false, false, false }); printObjectiveValues(formulaEvaluator, f, new Boolean[] { false, false, true }); printObjectiveValues(formulaEvaluator, f, new Boolean[] { false, true, false }); printObjectiveValues(formulaEvaluator, f, new Boolean[] { false, true, true }); printObjectiveValues(formulaEvaluator, f, new Boolean[] { true, false, false }); printObjectiveValues(formulaEvaluator, f, new Boolean[] { true, false, true }); printObjectiveValues(formulaEvaluator, f, new Boolean[] { true, true, false }); printObjectiveValues(formulaEvaluator, f, new Boolean[] { true, true, true }); }