test_class.declarator: builder = SilentChemObjectBuilder.getInstance()
test_class.modifier: private final static
test_class.original_string: private final static IChemObjectBuilder builder = SilentChemObjectBuilder.getInstance();
test_class.type: IChemObjectBuilder
test_class.var_name: builder
test_class.file: tool/formula/src/test/java/org/openscience/cdk/tools/manipulator/MolecularFormulaSetManipulatorTest.java
test_class.identifier: MolecularFormulaSetManipulatorTest
test_class.superclass: extends CDKTestCase
test_case.body: @Test
      public void testRemove_1() {
  
          IMolecularFormula formulaMin = new MolecularFormula();
          formulaMin.addIsotope(builder.newInstance(IIsotope.class, "C"), 1);
          formulaMin.addIsotope(builder.newInstance(IIsotope.class, "H"), 1);
          formulaMin.addIsotope(builder.newInstance(IIsotope.class, "N"), 1);
  
          IMolecularFormula formulaMax = new MolecularFormula();
          formulaMax.addIsotope(builder.newInstance(IIsotope.class, "C"), 4);
          formulaMax.addIsotope(builder.newInstance(IIsotope.class, "H"), 12);
          formulaMax.addIsotope(builder.newInstance(IIsotope.class, "N"), 2);
  
          IMolecularFormula mf1 = new MolecularFormula();
          mf1.addIsotope(builder.newInstance(IIsotope.class, "C"), 3);
          mf1.addIsotope(builder.newInstance(IIsotope.class, "H"), 10);
          mf1.addIsotope(builder.newInstance(IIsotope.class, "N"), 1);
  
          IMolecularFormula mf2 = new MolecularFormula();
          mf2.addIsotope(builder.newInstance(IIsotope.class, "C"), 1);
          mf2.addIsotope(builder.newInstance(IIsotope.class, "H"), 1);
          mf2.addIsotope(builder.newInstance(IIsotope.class, "N"), 1);
  
          IMolecularFormula mf3 = new MolecularFormula();
          mf3.addIsotope(builder.newInstance(IIsotope.class, "C"), 4);
          mf3.addIsotope(builder.newInstance(IIsotope.class, "H"), 12);
          mf3.addIsotope(builder.newInstance(IIsotope.class, "N"), 2);
  
          IMolecularFormula mf4 = new MolecularFormula();
          mf4.addIsotope(builder.newInstance(IIsotope.class, "C"), 7);
          mf4.addIsotope(builder.newInstance(IIsotope.class, "H"), 10);
          mf4.addIsotope(builder.newInstance(IIsotope.class, "N"), 1);
  
          IMolecularFormulaSet formulaSet = new MolecularFormulaSet();
          formulaSet.addMolecularFormula(mf1);
          formulaSet.addMolecularFormula(mf2);
          formulaSet.addMolecularFormula(mf3);
          formulaSet.addMolecularFormula(mf4);
  
          IMolecularFormulaSet newMFSet = MolecularFormulaSetManipulator.remove(formulaSet, formulaMin, formulaMax);
          /* the mf4 is excluded from the limits */
  
          Assert.assertEquals(3, newMFSet.size());
          Assert.assertEquals(MolecularFormulaManipulator.getString(mf1),
                  MolecularFormulaManipulator.getString(newMFSet.getMolecularFormula(0)));
          Assert.assertEquals(MolecularFormulaManipulator.getString(mf2),
                  MolecularFormulaManipulator.getString(newMFSet.getMolecularFormula(1)));
          Assert.assertEquals(MolecularFormulaManipulator.getString(mf3),
                  MolecularFormulaManipulator.getString(newMFSet.getMolecularFormula(2)));
  
      }
test_case.class_method_signature: MolecularFormulaSetManipulatorTest.testRemove_1()
test_case.full_signature: @Test public void testRemove_1()
test_case.identifier: testRemove_1
test_case.invocations: addIsotope newInstance addIsotope newInstance addIsotope newInstance addIsotope newInstance addIsotope newInstance addIsotope newInstance addIsotope newInstance addIsotope newInstance addIsotope newInstance addIsotope newInstance addIsotope newInstance addIsotope newInstance addIsotope newInstance addIsotope newInstance addIsotope newInstance addIsotope newInstance addIsotope newInstance addIsotope newInstance addMolecularFormula addMolecularFormula addMolecularFormula addMolecularFormula remove assertEquals size assertEquals getString getString getMolecularFormula assertEquals getString getString getMolecularFormula assertEquals getString getString getMolecularFormula
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testRemove_1()
focal_class.file: tool/formula/src/main/java/org/openscience/cdk/tools/manipulator/MolecularFormulaSetManipulator.java
focal_class.identifier: MolecularFormulaSetManipulator
focal_class.class_method_signature: MolecularFormulaSetManipulator.getMaxOccurrenceElements(IMolecularFormulaSet mfSet)
focal_class.full_signature: public static IMolecularFormula getMaxOccurrenceElements(IMolecularFormulaSet mfSet)
focal_class.identifier: getMaxOccurrenceElements
focal_class.modifiers: public static
focal_class.parameters: (IMolecularFormulaSet mfSet)
focal_class.return: IMolecularFormula
focal_class.signature: IMolecularFormula getMaxOccurrenceElements(IMolecularFormulaSet mfSet)
focal_class.class_method_signature: MolecularFormulaSetManipulator.getMinOccurrenceElements(IMolecularFormulaSet mfSet)
focal_class.full_signature: public static IMolecularFormula getMinOccurrenceElements(IMolecularFormulaSet mfSet)
focal_class.identifier: getMinOccurrenceElements
focal_class.modifiers: public static
focal_class.parameters: (IMolecularFormulaSet mfSet)
focal_class.return: IMolecularFormula
focal_class.signature: IMolecularFormula getMinOccurrenceElements(IMolecularFormulaSet mfSet)
focal_class.class_method_signature: MolecularFormulaSetManipulator.remove(IMolecularFormulaSet formulaSet, IMolecularFormula formulaMin,
              IMolecularFormula formulaMax)
focal_class.full_signature: public static IMolecularFormulaSet remove(IMolecularFormulaSet formulaSet, IMolecularFormula formulaMin,
              IMolecularFormula formulaMax)
focal_class.identifier: remove
focal_class.modifiers: public static
focal_class.parameters: (IMolecularFormulaSet formulaSet, IMolecularFormula formulaMin,
              IMolecularFormula formulaMax)
focal_class.return: IMolecularFormulaSet
focal_class.signature: IMolecularFormulaSet remove(IMolecularFormulaSet formulaSet, IMolecularFormula formulaMin,
              IMolecularFormula formulaMax)
focal_class.class_method_signature: MolecularFormulaSetManipulator.validCorrelation(IMolecularFormula formulaMin, IMolecularFormula formulamax)
focal_class.full_signature: private static boolean validCorrelation(IMolecularFormula formulaMin, IMolecularFormula formulamax)
focal_class.identifier: validCorrelation
focal_class.modifiers: private static
focal_class.parameters: (IMolecularFormula formulaMin, IMolecularFormula formulamax)
focal_class.return: boolean
focal_class.signature: boolean validCorrelation(IMolecularFormula formulaMin, IMolecularFormula formulamax)
focal_class.class_method_signature: MolecularFormulaSetManipulator.contains(IMolecularFormulaSet formulaSet, IMolecularFormula formula)
focal_class.full_signature: public static boolean contains(IMolecularFormulaSet formulaSet, IMolecularFormula formula)
focal_class.identifier: contains
focal_class.modifiers: public static
focal_class.parameters: (IMolecularFormulaSet formulaSet, IMolecularFormula formula)
focal_class.return: boolean
focal_class.signature: boolean contains(IMolecularFormulaSet formulaSet, IMolecularFormula formula)
focal_class.class_method_signature: MolecularFormulaSetManipulator.remove(IMolecularFormulaSet formulaSet, MolecularFormulaRange formulaRange)
focal_class.full_signature: public static IMolecularFormulaSet remove(IMolecularFormulaSet formulaSet, MolecularFormulaRange formulaRange)
focal_class.identifier: remove
focal_class.modifiers: public static
focal_class.parameters: (IMolecularFormulaSet formulaSet, MolecularFormulaRange formulaRange)
focal_class.return: IMolecularFormulaSet
focal_class.signature: IMolecularFormulaSet remove(IMolecularFormulaSet formulaSet, MolecularFormulaRange formulaRange)
focal_method.body: public static IMolecularFormulaSet remove(IMolecularFormulaSet formulaSet, IMolecularFormula formulaMin,
              IMolecularFormula formulaMax) {
  
          // prove the correlation between maximum and minimum molecularFormula
          if (!validCorrelation(formulaMin, formulaMax)) return null;
  
          IMolecularFormulaSet newFormulaSet = formulaSet.getBuilder().newInstance(IMolecularFormulaSet.class);
  
          for (IMolecularFormula formula : formulaSet.molecularFormulas()) {
              boolean flagPass = true;
  
              // the formula must contain all element found into the formulaMin
              if (!validCorrelation(formula, formulaMin)) continue;
  
              for (IElement element : MolecularFormulaManipulator.elements(formulaMin)) {
                  int occur = MolecularFormulaManipulator.getElementCount(formula, element);
                  int occurMax = MolecularFormulaManipulator.getElementCount(formulaMax, element);
                  int occurMin = MolecularFormulaManipulator.getElementCount(formulaMin, element);
  
                  if (!(occurMin <= occur) || !(occur <= occurMax)) {
                      flagPass = false;
                      break;
                  }
  
              }
              if (flagPass) // stored if each IElement occurrence is into the limits
                  newFormulaSet.addMolecularFormula(formula);
  
          }
          return newFormulaSet;
      }
focal_method.class_method_signature: MolecularFormulaSetManipulator.remove(IMolecularFormulaSet formulaSet, IMolecularFormula formulaMin,
              IMolecularFormula formulaMax)
focal_method.full_signature: public static IMolecularFormulaSet remove(IMolecularFormulaSet formulaSet, IMolecularFormula formulaMin,
              IMolecularFormula formulaMax)
focal_method.identifier: remove
focal_method.invocations: validCorrelation newInstance getBuilder molecularFormulas validCorrelation elements getElementCount getElementCount getElementCount addMolecularFormula
focal_method.modifiers: public static
focal_method.parameters: (IMolecularFormulaSet formulaSet, IMolecularFormula formulaMin,
              IMolecularFormula formulaMax)
focal_method.return: IMolecularFormulaSet
focal_method.signature: IMolecularFormulaSet remove(IMolecularFormulaSet formulaSet, IMolecularFormula formulaMin,
              IMolecularFormula formulaMax)