/** * 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; }
/** {@inheritDoc} */ @Override public void add(IMolecularFormulaSet formulaSet) { logger.debug("Adding a formula set: ", formulaSet); super.add(formulaSet); }
/** {@inheritDoc} */ @Override public void addMolecularFormula(IMolecularFormula formula) { logger.debug("Adding formula: ", formula); super.addMolecularFormula(formula); }
/** * A unit test suite for JUnit. * * @return The test suite */ @Test public void testAdductFormula() { IAdductFormula mfS = new AdductFormula(); Assert.assertNotNull(mfS); }
/** {@inheritDoc} */ @Override public Iterable<IMolecularFormula> molecularFormulas() { logger.debug("Getting molecular formula iterable..."); return super.molecularFormulas(); }
/** {@inheritDoc} */ @Override public Iterable<IIsotope> isotopes() { logger.debug("Getting isotope iterator.."); return super.isotopes(); }
/** {@inheritDoc} */ @Override public int getIsotopeCount() { logger.debug("Getting isotope count: ", super.getIsotopeCount()); return super.getIsotopeCount(); }
/** {@inheritDoc} */ @Override public boolean contains(IMolecularFormula formula) { logger.debug("Contains formula?: ", formula); return super.contains(formula); }
/** {@inheritDoc} */ @Override public Integer getCharge() { Integer charge = super.getCharge(); logger.debug("Getting charge: ", charge); return charge; }
/** {@inheritDoc} */ @Override public IMolecularFormula getMolecularFormula(int position) { logger.debug("Getting formula at: ", position); return super.getMolecularFormula(position); }
/** * 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); } /* * notifyChanged() is called by addAtomContainer() */ }
/** * A unit test suite for JUnit. * * @return The test suite */ @Test public void testAdductFormula_IMolecularFormula() { IAdductFormula mfS = new AdductFormula(getBuilder().newInstance(IMolecularFormula.class)); Assert.assertEquals(1, mfS.size()); } }
/** {@inheritDoc} */ @Override public int getIsotopeCount(IIsotope isotope) { logger.debug("Getting isotope count for: ", isotope); return super.getIsotopeCount(isotope); }
/** {@inheritDoc} */ @Override public boolean contains(IIsotope isotope) { logger.debug("Contains Isotope?: ", isotope); return super.contains(isotope); }
/** * 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; }
/** * 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); } /* * notifyChanged() is called by addAtomContainer() */ }