EquitablePartitionRefiner { public Partition refine(Partition coarser) { Partition finer = new Partition(coarser); blocksToRefine = new LinkedList<Set<Integer>>(); for (int i = 0; i < finer.size(); i++) { blocksToRefine.add(finer.copyBlock(i)); } int numberOfVertices = refinable.getVertexCount(); while (!blocksToRefine.isEmpty()) { Set<Integer> t = blocksToRefine.remove(); currentBlockIndex = 0; while (currentBlockIndex < finer.size() && finer.size() < numberOfVertices) { if (!finer.isDiscreteCell(currentBlockIndex)) { Map<Invariant, SortedSet<Integer>> invariants = getInvariants(finer, t); split(invariants, finer); } currentBlockIndex++; } if (finer.size() == numberOfVertices) { return finer; } } return finer; } EquitablePartitionRefiner(Refinable refinable); void setSplitOrder(SplitOrder splitOrder); Partition refine(Partition coarser);  }
@Test public void refineTest() { EquitablePartitionRefiner refiner = new EquitablePartitionRefiner(makeExampleTable()); Partition coarser = Partition.fromString("[0|1,2,3]"); Partition finer = refiner.refine(coarser); Partition expected = Partition.fromString("[0|1,2|3]"); Assert.assertEquals(expected, finer); }