/** * Clones this AdductFormula object and its content. * * @return The cloned object */ @Override public Object clone() throws CloneNotSupportedException { // /* it is not a super class of chemObject */ // AdductFormula clone = (AdductFormula) super.clone(); // // start from scratch // clone.removeAllMolecularFormulas(); // // clone all molecularFormulas // Iterator<IMolecularFormula> iterForm = this.molecularFormulas(); // while(iterForm.hasNext()){ // clone.addMolecularFormula((IMolecularFormula) iterForm.next().clone()); // } AdductFormula clone = new AdductFormula(); for (IMolecularFormula form : this.molecularFormulas()) { clone.addMolecularFormula((IMolecularFormula) form.clone()); } return clone; }
/** * True, if the AdductFormula contains the given IIsotope object and not * the instance. The method looks for other isotopes which has the same * symbol, natural abundance and exact mass. * * @param isotope The IIsotope this AdductFormula is searched for * @return True, if the AdductFormula contains the given isotope object */ @Override public boolean contains(IIsotope isotope) { for (Iterator<IIsotope> it = isotopes().iterator(); it.hasNext();) { IIsotope thisIsotope = it.next(); if (isTheSame(thisIsotope, isotope)) { return true; } } return false; }
/** * Checks a set of Nodes for the number of different isotopes in the * adduct formula. * * @return The the number of different isotopes in this adduct formula * @see #getIsotopeCount(IIsotope) */ @Override public int getIsotopeCount() { return isotopesList().size(); }
@Test public void testAdductFormula() { IAdductFormula mfS = new AdductFormula(); Assert.assertNotNull(mfS); }
/** * Adds all molecularFormulas in the AdductFormula to this chemObject. * * @param formulaSet The MolecularFormulaSet */ @Override public void add(IMolecularFormulaSet formulaSet) { for (IMolecularFormula mf : formulaSet.molecularFormulas()) { addMolecularFormula(mf); } }
@Test public void testAdductFormula_IMolecularFormula() { IAdductFormula mfS = new AdductFormula(getBuilder().newInstance(IMolecularFormula.class)); Assert.assertEquals(1, mfS.size()); }
/** * Adds all molecularFormulas in the AdductFormula to this chemObject. * * @param formulaSet The MolecularFormulaSet */ @Override public void add(IMolecularFormulaSet formulaSet) { for (IMolecularFormula mf : formulaSet.molecularFormulas()) { addMolecularFormula(mf); } }
/** * Clones this AdductFormula object and its content. * * @return The cloned object */ @Override public Object clone() throws CloneNotSupportedException { // /* it is not a super class of chemObject */ // AdductFormula clone = (AdductFormula) super.clone(); // // start from scratch // clone.removeAllMolecularFormulas(); // // clone all molecularFormulas // Iterator<IMolecularFormula> iterForm = this.molecularFormulas(); // while(iterForm.hasNext()){ // clone.addMolecularFormula((IMolecularFormula) iterForm.next().clone()); // } AdductFormula clone = new AdductFormula(); for (IMolecularFormula form : this.molecularFormulas()) { clone.addMolecularFormula((IMolecularFormula) form.clone()); } return clone; }
/** * True, if the AdductFormula contains the given IIsotope object and not * the instance. The method looks for other isotopes which has the same * symbol, natural abundance and exact mass. * * @param isotope The IIsotope this AdductFormula is searched for * @return True, if the AdductFormula contains the given isotope object */ @Override public boolean contains(IIsotope isotope) { for (Iterator<IIsotope> it = isotopes().iterator(); it.hasNext();) { IIsotope thisIsotope = it.next(); if (isTheSame(thisIsotope, isotope)) { return true; } } return false; }
/** * Checks a set of Nodes for the number of different isotopes in the * adduct formula. * * @return The the number of different isotopes in this adduct formula * @see #getIsotopeCount(IIsotope) */ @Override public int getIsotopeCount() { return isotopesList().size(); }