private IMolecularFormula putInOrder ( IMolecularFormula formula ) { IMolecularFormula new_formula = formula . getBuilder ( ) . newInstance ( IMolecularFormula . class ) ; for ( int i = 0 ; i < orderElements . length ; i ++ ) { IElement element = builder . newInstance ( IElement . class , orderElements [ i ] ) ; if ( MolecularFormulaManipulator . containsElement ( formula , element ) ) { Iterator < IIsotope > isotopes = MolecularFormulaManipulator . getIsotopes ( formula , element ) . iterator ( ) ; while ( isotopes . hasNext ( ) ) { IIsotope isotope = isotopes . next ( ) ; new_formula . addIsotope ( isotope , formula . getIsotopeCount ( isotope ) ) ; } } } // new_mf.setCharge(charge); return new_formula ; }
Put in order the elements of the molecular formula .