Skip to content

Commit

Permalink
Including JavaDoc for new methods. Would also be better to use Elemen…
Browse files Browse the repository at this point in the history
…ts from a symbol, currently the method is case sensitive.
  • Loading branch information
johnmay committed Feb 23, 2014
1 parent ee7907e commit 2fe701a
Showing 1 changed file with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,28 @@ public static int getElementCount(IMolecularFormula formula, IElement element) {
return count;
}

public static int getElementCount(IMolecularFormula formula, IIsotope isotope) {
return getElementCount(formula, formula.getBuilder().newInstance(IElement.class, isotope));
/**
* Occurrences of a given element from an isotope in a molecular formula.
*
* @param formula the formula
* @param isotope isotope of an element
* @return number of the times the element occurs
* @see #getElementCount(IMolecularFormula, IElement)
*/
public static int getElementCount(IMolecularFormula formula, IIsotope isotope) {
return getElementCount(formula, formula.getBuilder().newInstance(IElement.class, isotope));
}

public static int getElementCount(IMolecularFormula formula, String symbol) {
return getElementCount(formula, formula.getBuilder().newInstance(IIsotope.class, symbol));
/**
* Occurrences of a given element in a molecular formula.
*
* @param formula the formula
* @param symbol element symbol (e.g. C for carbon)
* @return number of the times the element occurs
* @see #getElementCount(IMolecularFormula, IElement)
*/
public static int getElementCount(IMolecularFormula formula, String symbol) {
return getElementCount(formula, formula.getBuilder().newInstance(IElement.class, symbol));
}

/**
Expand Down

0 comments on commit 2fe701a

Please sign in to comment.