QuickXPlain extends AbstractConflictDetection { @Override public Set<Constraint> getMinConflictSet(Set<Constraint> constraintsSetC) throws DiagnosisException { if (consistencyChecker.isConsistent(constraintsSetC, fixedModel)) { return null; } if (constraintsSetC.isEmpty()) { return Collections.emptySet(); } Set<Constraint> fixedConstraints = new LinkedHashSet<>(); fixedModel.stream().filter(e -> e instanceof Constraint).map(e -> (Constraint) e) .forEach(fixedConstraints::add); return quickXPlain(fixedConstraints, constraintsSetC, fixedConstraints); } QuickXPlain(String mznFullFileName);  QuickXPlain(String mznFullFileName, Collection<? extends Element> fixedModel); @Override Set<Constraint> getMinConflictSet(Set<Constraint> constraintsSetC);  }
@Test public void testQuickXPlainMinCS_2() throws FileNotFoundException, DiagnosisException { java.util.Set<Constraint> minCS = null; java.util.Set<Constraint> constraintsSetC = new LinkedHashSet<Constraint>(); java.util.Set<Element> decisionsVar = new LinkedHashSet<Element>(); String fileName = UtilsForTest.getTestDataset2(constraintsSetC, decisionsVar); AbstractConflictDetection conflictDetection = new QuickXPlain(fileName); minCS = conflictDetection.getMinConflictSet(constraintsSetC); assertNotNull(minCS); assertTrue(minCS.size() == 4); assertTrue(minCS.contains(new ArrayList<>(constraintsSetC).get(1))); assertTrue(minCS.contains(new ArrayList<>(constraintsSetC).get(2))); assertTrue(minCS.contains(new ArrayList<>(constraintsSetC).get(3))); assertTrue(minCS.contains(new ArrayList<>(constraintsSetC).get(4))); }
@Test public void testQuickXPlainMinCS_2WithMoreConstraints() throws FileNotFoundException, DiagnosisException { java.util.Set<Constraint> minCS = null; java.util.Set<Constraint> constraintsSetC = new LinkedHashSet<Constraint>(); java.util.Set<Element> decisionsVar = new LinkedHashSet<Element>(); String fileName = UtilsForTest.getTestDataset2WithMoreConstraints(constraintsSetC, decisionsVar); AbstractConflictDetection conflictDetection = new QuickXPlain(fileName); minCS = conflictDetection.getMinConflictSet(constraintsSetC); assertNotNull(minCS); assertTrue(minCS.size() == 2); assertTrue(minCS.contains(new ArrayList<>(constraintsSetC).get(4))); assertTrue(minCS.contains(new ArrayList<>(constraintsSetC).get(5))); }
@Test public void testQuickXPlainMinCS_NoConflict() throws FileNotFoundException, DiagnosisException { java.util.Set<Constraint> minCS = null; java.util.Set<Constraint> constraintsSetC = new LinkedHashSet<Constraint>(); java.util.Set<Element> decisionsVar = new LinkedHashSet<Element>(); String fileName = UtilsForTest.getTestDataset2NoConflict(constraintsSetC, decisionsVar); AbstractConflictDetection conflictDetection = new QuickXPlain(fileName); minCS = conflictDetection.getMinConflictSet(constraintsSetC); assertNull(minCS); }
@Test public void testQuickXPlainMinCS_5() throws FileNotFoundException, DiagnosisException { java.util.Set<Constraint> minCS = null; java.util.Set<Constraint> constraintsSetC = new LinkedHashSet<Constraint>(); java.util.Set<Element> decisionsVar = new LinkedHashSet<Element>(); String fileName = UtilsForTest.getTestDataset1(constraintsSetC, decisionsVar); AbstractConflictDetection conflictDetection = new QuickXPlain(fileName); minCS = conflictDetection.getMinConflictSet(constraintsSetC); assertNotNull(minCS); assertTrue(minCS.size() == 1); assertTrue(minCS.contains(new ArrayList<>(constraintsSetC).get(1))); }
@Test public void testQuickXPlainMinCS_6() throws FileNotFoundException, DiagnosisException { java.util.Set<Constraint> minCS = null; java.util.Set<Constraint> constraintsSetC = new LinkedHashSet<Constraint>(); java.util.Set<Element> decisionsVar = new LinkedHashSet<Element>(); String fileName = UtilsForTest.getTestDataset6(constraintsSetC, decisionsVar); AbstractConflictDetection conflictDetection = new QuickXPlain(fileName); minCS = conflictDetection.getMinConflictSet(constraintsSetC); assertNotNull(minCS); assertTrue(minCS.size() == 2); assertTrue(minCS.contains(new ArrayList<>(constraintsSetC).get(0))); assertTrue(minCS.contains(new ArrayList<>(constraintsSetC).get(1))); }
@Test public void testQuickXPlainMinCS_8() throws FileNotFoundException, DiagnosisException { java.util.Set<Constraint> minCS = null; java.util.Set<Constraint> constraintsSetC = new LinkedHashSet<Constraint>(); java.util.Set<Element> decisionsVar = new LinkedHashSet<Element>(); String fileName = UtilsForTest.getTestDataset8(constraintsSetC, decisionsVar); AbstractConflictDetection conflictDetection = new QuickXPlain(fileName); minCS = conflictDetection.getMinConflictSet(constraintsSetC); assertNotNull(minCS); assertTrue(minCS.size() == 1); assertTrue(minCS.contains(new ArrayList<>(constraintsSetC).get(3))); }