test_class.file: tool/group/src/test/java/org/openscience/cdk/group/EquitablePartitionRefinerTest.java
test_class.identifier: EquitablePartitionRefinerTest
test_class.superclass: extends CDKTestCase
test_case.body: @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);
      }
test_case.class_method_signature: EquitablePartitionRefinerTest.refineTest()
test_case.full_signature: @Test public void refineTest()
test_case.identifier: refineTest
test_case.invocations: makeExampleTable fromString refine fromString assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void refineTest()
focal_class.declarator: refinable
focal_class.modifier: private final
focal_class.original_string: private final Refinable refinable;
focal_class.type: Refinable
focal_class.var_name: refinable
focal_class.declarator: splitOrder = SplitOrder.FORWARD
focal_class.modifier: private
focal_class.original_string: private SplitOrder          splitOrder = SplitOrder.FORWARD;
focal_class.type: SplitOrder
focal_class.var_name: splitOrder
focal_class.declarator: currentBlockIndex
focal_class.modifier: private
focal_class.original_string: private int                 currentBlockIndex;
focal_class.type: int
focal_class.var_name: currentBlockIndex
focal_class.declarator: blocksToRefine
focal_class.modifier: private
focal_class.original_string: private Queue<Set<Integer>> blocksToRefine;
focal_class.type: Queue<Set<Integer>>
focal_class.var_name: blocksToRefine
focal_class.file: tool/group/src/main/java/org/openscience/cdk/group/EquitablePartitionRefiner.java
focal_class.identifier: EquitablePartitionRefiner
focal_class.class_method_signature: EquitablePartitionRefiner.EquitablePartitionRefiner(Refinable refinable)
focal_class.full_signature: public  EquitablePartitionRefiner(Refinable refinable)
focal_class.identifier: EquitablePartitionRefiner
focal_class.modifiers: public
focal_class.parameters: (Refinable refinable)
focal_class.signature:  EquitablePartitionRefiner(Refinable refinable)
focal_class.class_method_signature: EquitablePartitionRefiner.setSplitOrder(SplitOrder splitOrder)
focal_class.full_signature: public void setSplitOrder(SplitOrder splitOrder)
focal_class.identifier: setSplitOrder
focal_class.modifiers: public
focal_class.parameters: (SplitOrder splitOrder)
focal_class.return: void
focal_class.signature: void setSplitOrder(SplitOrder splitOrder)
focal_class.class_method_signature: EquitablePartitionRefiner.refine(Partition coarser)
focal_class.full_signature: public Partition refine(Partition coarser)
focal_class.identifier: refine
focal_class.modifiers: public
focal_class.parameters: (Partition coarser)
focal_class.return: Partition
focal_class.signature: Partition refine(Partition coarser)
focal_class.class_method_signature: EquitablePartitionRefiner.getInvariants(Partition partition, Set<Integer> targetBlock)
focal_class.full_signature: private Map<Invariant, SortedSet<Integer>> getInvariants(Partition partition, Set<Integer> targetBlock)
focal_class.identifier: getInvariants
focal_class.modifiers: private
focal_class.parameters: (Partition partition, Set<Integer> targetBlock)
focal_class.return: Map<Invariant, SortedSet<Integer>>
focal_class.signature: Map<Invariant, SortedSet<Integer>> getInvariants(Partition partition, Set<Integer> targetBlock)
focal_class.class_method_signature: EquitablePartitionRefiner.split(Map<Invariant, SortedSet<Integer>> invariants, Partition partition)
focal_class.full_signature: private void split(Map<Invariant, SortedSet<Integer>> invariants, Partition partition)
focal_class.identifier: split
focal_class.modifiers: private
focal_class.parameters: (Map<Invariant, SortedSet<Integer>> invariants, Partition partition)
focal_class.return: void
focal_class.signature: void split(Map<Invariant, SortedSet<Integer>> invariants, Partition partition)
focal_method.body: public Partition refine(Partition coarser) {
          Partition finer = new Partition(coarser);
  
          // start the queue with the blocks of a in reverse order
          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)) {
  
                      // get the neighbor invariants for this block
                      Map<Invariant, SortedSet<Integer>> invariants = getInvariants(finer, t);
  
                      // split the block on the basis of these invariants
                      split(invariants, finer);
                  }
                  currentBlockIndex++;
              }
  
              // the partition is discrete
              if (finer.size() == numberOfVertices) {
                  return finer;
              }
          }
          return finer;
      }
focal_method.class_method_signature: EquitablePartitionRefiner.refine(Partition coarser)
focal_method.full_signature: public Partition refine(Partition coarser)
focal_method.identifier: refine
focal_method.invocations: size add copyBlock getVertexCount isEmpty remove size size isDiscreteCell getInvariants split size
focal_method.modifiers: public
focal_method.parameters: (Partition coarser)
focal_method.return: Partition
focal_method.signature: Partition refine(Partition coarser)