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 testGetMinOccurrenceElements_IMolecularFormulaSet() {
          IMolecularFormula mf1 = new MolecularFormula(); /* C4H12NO4 */
          mf1.addIsotope(builder.newInstance(IIsotope.class, "C"), 4);
          mf1.addIsotope(builder.newInstance(IIsotope.class, "H"), 12);
          mf1.addIsotope(builder.newInstance(IIsotope.class, "N"), 1);
          mf1.addIsotope(builder.newInstance(IIsotope.class, "O"), 4);
  
          IMolecularFormula mf2 = new MolecularFormula(); /* C7H20N4O2 */
          mf2.addIsotope(builder.newInstance(IIsotope.class, "C"), 7);
          mf2.addIsotope(builder.newInstance(IIsotope.class, "H"), 20);
          mf2.addIsotope(builder.newInstance(IIsotope.class, "N"), 4);
          mf2.addIsotope(builder.newInstance(IIsotope.class, "O"), 2);
  
          IMolecularFormula mf3 = new MolecularFormula(); /* C9H5O7 */
          mf3.addIsotope(builder.newInstance(IIsotope.class, "C"), 9);
          mf3.addIsotope(builder.newInstance(IIsotope.class, "H"), 5);
          mf3.addIsotope(builder.newInstance(IIsotope.class, "O"), 7);
  
          IMolecularFormulaSet mfSet = new MolecularFormulaSet();
          mfSet.addMolecularFormula(mf1);
          mfSet.addMolecularFormula(mf2);
          mfSet.addMolecularFormula(mf3);
  
          IMolecularFormula molecularFormula = MolecularFormulaSetManipulator.getMinOccurrenceElements(mfSet);
  
          /* Result: C4H5NO2 */
  
          Assert.assertEquals(12, MolecularFormulaManipulator.getAtomCount(molecularFormula));
          Assert.assertEquals(4, molecularFormula.getIsotopeCount());
          Assert.assertEquals(4, molecularFormula.getIsotopeCount(builder.newInstance(IIsotope.class, "C")));
          Assert.assertEquals(5, molecularFormula.getIsotopeCount(builder.newInstance(IIsotope.class, "H")));
          Assert.assertEquals(1, molecularFormula.getIsotopeCount(builder.newInstance(IIsotope.class, "N")));
          Assert.assertEquals(2, molecularFormula.getIsotopeCount(builder.newInstance(IIsotope.class, "O")));
  
      }
test_case.class_method_signature: MolecularFormulaSetManipulatorTest.testGetMinOccurrenceElements_IMolecularFormulaSet()
test_case.full_signature: @Test public void testGetMinOccurrenceElements_IMolecularFormulaSet()
test_case.identifier: testGetMinOccurrenceElements_IMolecularFormulaSet
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 addMolecularFormula addMolecularFormula addMolecularFormula getMinOccurrenceElements assertEquals getAtomCount assertEquals getIsotopeCount assertEquals getIsotopeCount newInstance assertEquals getIsotopeCount newInstance assertEquals getIsotopeCount newInstance assertEquals getIsotopeCount newInstance
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetMinOccurrenceElements_IMolecularFormulaSet()
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 IMolecularFormula getMinOccurrenceElements(IMolecularFormulaSet mfSet) {
  
          IMolecularFormula molecularFormula = mfSet.getBuilder().newInstance(IMolecularFormula.class);
          for (IMolecularFormula mf : mfSet.molecularFormulas()) {
              for (IIsotope isotope : mf.isotopes()) {
                  IElement element = mfSet.getBuilder().newInstance(IElement.class, isotope);
                  int occur_new = MolecularFormulaManipulator.getElementCount(mf, element);
                  if (!MolecularFormulaManipulator.containsElement(molecularFormula, element)) {
                      molecularFormula.addIsotope(mfSet.getBuilder().newInstance(IIsotope.class, element), occur_new);
                  } else {
                      int occur_old = MolecularFormulaManipulator.getElementCount(molecularFormula, element);
                      if (occur_new < occur_old) {
                          MolecularFormulaManipulator.removeElement(molecularFormula, element);
                          molecularFormula.addIsotope(mfSet.getBuilder().newInstance(IIsotope.class, element), occur_new);
                      }
                  }
              }
          }
          return molecularFormula;
      }
focal_method.class_method_signature: MolecularFormulaSetManipulator.getMinOccurrenceElements(IMolecularFormulaSet mfSet)
focal_method.full_signature: public static IMolecularFormula getMinOccurrenceElements(IMolecularFormulaSet mfSet)
focal_method.identifier: getMinOccurrenceElements
focal_method.invocations: newInstance getBuilder molecularFormulas isotopes newInstance getBuilder getElementCount containsElement addIsotope newInstance getBuilder getElementCount removeElement addIsotope newInstance getBuilder
focal_method.modifiers: public static
focal_method.parameters: (IMolecularFormulaSet mfSet)
focal_method.return: IMolecularFormula
focal_method.signature: IMolecularFormula getMinOccurrenceElements(IMolecularFormulaSet mfSet)