Logo Search packages:      
Sourcecode: cdk version File versions  Download package

IsotopePattern.java

package org.openscience.cdk.formula;

import java.util.ArrayList;
import java.util.List;

import org.openscience.cdk.annotations.TestClass;
import org.openscience.cdk.annotations.TestMethod;



/**
 * This class defines the properties of a deisotoped
 * pattern distribution. A isotope pattern is a set of 
 * compounds with different set of isotopes.
 * 
 * @author Miguel Rojas Cherto
 * 
 * @cdk.module formula
 */
@TestClass("org.openscience.cdk.formula.IsotopePatternTest")
00021 public class IsotopePattern {

      private List<IsotopeContainer> isotopeCList = new ArrayList<IsotopeContainer>();

      private int monoIsotopePosition;

      private double chargI=0;
      
      /**
       * Constructor of the IsotopePattern object.
       */
00032       public IsotopePattern(){
            
      }
      /**
       * Set the mono isotope object.
       * 
       *  @param isoContainer   The IsotopeContainer object
       */
      @TestMethod("testSetMonoIsotope_IsotopeContainer")
00041       public void setMonoIsotope(IsotopeContainer isoContainer){
            isotopeCList.add(isoContainer);
            monoIsotopePosition = isotopeCList.indexOf(isoContainer);
      }
      /**
       * Add an isotope object.
       * 
       *  @param isoContainer   The IsotopeContainer object
       */
      @TestMethod("testAddIsotope_IsotopeContainer")
00051       public void addIsotope(IsotopeContainer isoContainer){
            isotopeCList.add(isoContainer);
      }
      /**
     * Returns the mono-isotope peak that form this isotope pattern.
     * 
     * @return The IsotopeContainer acting as mono-isotope
     */
      @TestMethod("testGetMonoIsotope")
00060     public IsotopeContainer getMonoIsotope(){
      return isotopeCList.get(monoIsotopePosition);
    }
    
    /**
     * Returns the all isotopes that form this isotope pattern.
     * 
     * @return The IsotopeContainer acting as mono-isotope
     */
      @TestMethod("testGetIsotopes")
00070     public List<IsotopeContainer > getIsotopes(){
      return isotopeCList;
    }
    /**
     * Returns the a isotopes given a specific position.
     * 
     * @param  position position of the isotope to return
     * @return The isotope
     */
      @TestMethod("testGetIsotope_int")
00080     public IsotopeContainer getIsotope(int position){
      return isotopeCList.get(position);
    }
    /**
     * Returns the number of isotopes in this pattern.
     * 
     * @return The number of isotopes
     */
      @TestMethod("testGetNumberOfIsotopes")
00089     public int getNumberOfIsotopes(){
      return isotopeCList.size();
    }

    /**
     * Set the charge in this pattern.
     * 
     * @param charge The charge value
     */
      @TestMethod("testSetCharge_double")
00099       public void setCharge(double charge) {
            chargI = charge;
            
      }

    /**
     * Get the charge in this pattern.
     * 
     * @return The charge value
     */
      @TestMethod("testGetCharge")
00110       public double getCharge() {
            return chargI;
            
      }
    /**
       * Clones this IsotopePattern object and its content. 
       *
       * @return    The cloned object
       */
      @TestMethod("testClone")
00120       public Object clone() throws CloneNotSupportedException {
      IsotopePattern isoClone = new IsotopePattern();
      IsotopeContainer isoHighest = getMonoIsotope();
      for(IsotopeContainer isoContainer: isotopeCList){
            if(isoHighest.equals(isoContainer))
                  isoClone.setMonoIsotope((IsotopeContainer) isoContainer.clone());
            else
                  isoClone.addIsotope((IsotopeContainer) isoContainer.clone());
      }
      isoClone.setCharge(getCharge());
      return isoClone;
    }
}

Generated by  Doxygen 1.6.0   Back to index