Skip to content

Commit

Permalink
Update MF documentation on charge.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmay committed Nov 28, 2016
1 parent e60c7aa commit 4803746
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class MolecularFormula implements IMolecularFormula {
/**
* The partial charge of the molecularFormula. The default value is Double.NaN.
*/
private Integer charge = (Integer) CDKConstants.UNSET;
private Integer charge = null;

/**
* A hashtable for the storage of any kind of properties of this IChemObject.
Expand Down Expand Up @@ -150,12 +150,7 @@ public boolean contains(IIsotope isotope) {
}

/**
* Returns the partial charge of this IMolecularFormula. If the charge
* has not been set the return value is Double.NaN.
*
* @return the charge of this IMolecularFormula
*
* @see #setCharge
* {@inheritDoc}
*/
@Override
public Integer getCharge() {
Expand Down Expand Up @@ -214,11 +209,7 @@ public Iterable<IIsotope> isotopes() {
}

/**
* Sets the partial charge of this IMolecularFormula.
*
* @param charge The partial charge
*
* @see #getCharge
* {@inheritDoc}
*/
@Override
public void setCharge(Integer charge) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,20 @@ public interface IMolecularFormula extends ICDKObject {
public void removeAllIsotopes();

/**
* Sets the partial charge of this IMolecularFormula.
* Sets the charge of this IMolecularFormula, since there is no atom
* associated with the charge the number of a given isotope is not modified.
*
* <pre>{@code
* // Correct usage
* IMolecularFormula phenolate = MolecularFormulaManipulator.getMolecularFormula("C6H5O", builder)
* mf.setCharge(-1);
* // MF=C6H5O-
*
* // Wrong! the H6 is not automatically adjust
* IMolecularFormula phenolate = MolecularFormulaManipulator.getMolecularFormula("C6H6O", builder)
* mf.setCharge(-1);
* // MF=C6H6O- (wrong)
* }</pre>
*
* @param charge The partial charge
*
Expand All @@ -125,8 +138,8 @@ public interface IMolecularFormula extends ICDKObject {
public void setCharge(Integer charge);

/**
* Returns the partial charge of this IMolecularFormula. If the charge
* has not been set the return value is Double.NaN.
* Access the charge of this IMolecularFormula. If the charge
* has not been set the return value is null.
*
* @return the charge of this IMolecularFormula
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,7 @@ public boolean contains(IIsotope isotope) {
}

/**
* Returns the partial charge of this IMolecularFormula. If the charge
* has not been set the return value is Double.NaN.
*
* @return the charge of this IMolecularFormula
*
* @see #setCharge
* {@inheritDoc}
*/
@Override
public Integer getCharge() {
Expand Down Expand Up @@ -211,11 +206,7 @@ public Iterable<IIsotope> isotopes() {
}

/**
* Sets the partial charge of this IMolecularFormula.
*
* @param charge The partial charge
*
* @see #getCharge
* {@inheritDoc}
*/
@Override
public void setCharge(Integer charge) {
Expand Down

0 comments on commit 4803746

Please sign in to comment.