Skip to content

Commit

Permalink
Updated Atom(String) constructor to call the Atom(Element) constructo…
Browse files Browse the repository at this point in the history
…r, so that even if we instantiate an atom just by symbol we still get an atomic number. Needed to update the Element constructor to accept Integer

Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information
rajarshi authored and egonw committed Dec 10, 2010
1 parent 91ca909 commit e5951db
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/main/org/openscience/cdk/Atom.java
Expand Up @@ -24,13 +24,13 @@
*/
package org.openscience.cdk;

import java.io.Serializable;
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IElement;
import org.openscience.cdk.tools.periodictable.PeriodicTable;

import javax.vecmath.Point2d;
import javax.vecmath.Point3d;

import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IElement;
import java.io.Serializable;

/**
* Represents the idea of an chemical atom.
Expand Down Expand Up @@ -119,7 +119,7 @@ public Atom() {
* @param elementSymbol The String describing the element for the Atom
*/
public Atom(String elementSymbol) {
super(elementSymbol);
this(new Element(elementSymbol, PeriodicTable.getAtomicNumber(elementSymbol)));
}

/**
Expand Down Expand Up @@ -214,7 +214,7 @@ public Double getCharge() {
*
* @param hydrogenCount The number of hydrogen atoms bonded to this atom.
*
* @see #getHydrogenCount
* @see #getImplicitHydrogenCount
*/
public void setImplicitHydrogenCount(Integer hydrogenCount) {
this.hydrogenCount = hydrogenCount;
Expand All @@ -226,7 +226,7 @@ public void setImplicitHydrogenCount(Integer hydrogenCount) {
*
* @return The hydrogen count of this atom.
*
* @see #setHydrogenCount
* @see #setImplicitHydrogenCount
*/
public Integer getImplicitHydrogenCount() {
return this.hydrogenCount;
Expand Down
2 changes: 1 addition & 1 deletion src/main/org/openscience/cdk/Element.java
Expand Up @@ -104,7 +104,7 @@ public Element(String symbol) {
* @param symbol The element symbol of this element.
* @param atomicNumber The atomicNumber of this element.
*/
public Element(String symbol, int atomicNumber) {
public Element(String symbol, Integer atomicNumber) {
this(symbol);
this.atomicNumber = atomicNumber;
}
Expand Down

0 comments on commit e5951db

Please sign in to comment.