Skip to content

Commit

Permalink
Revert "automatically set atomic number when given an element symbol,…
Browse files Browse the repository at this point in the history
… fixes bug/1296"

This reverts commit 2d80a80.
  • Loading branch information
egonw committed Apr 20, 2013
1 parent e29adca commit 94f02e5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 deletions.
6 changes: 3 additions & 3 deletions src/main/org/openscience/cdk/Element.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
package org.openscience.cdk;

import org.openscience.cdk.interfaces.IElement;
import org.openscience.cdk.tools.periodictable.PeriodicTable;

import java.io.Serializable;

Expand Down Expand Up @@ -94,7 +93,8 @@ public Element(IElement element) {
* @param symbol The element symbol that this element should have.
*/
public Element(String symbol) {
this(symbol, PeriodicTable.getAtomicNumber(symbol));
this();
this.symbol = symbol;
}

/**
Expand All @@ -105,7 +105,7 @@ public Element(String symbol) {
* @param atomicNumber The atomicNumber of this element.
*/
public Element(String symbol, Integer atomicNumber) {
this.symbol = symbol;
this(symbol);
this.atomicNumber = atomicNumber;
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/org/openscience/cdk/silent/Element.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

import org.openscience.cdk.CDKConstants;
import org.openscience.cdk.interfaces.IElement;
import org.openscience.cdk.tools.periodictable.PeriodicTable;

/**
* Implements the idea of an element in the periodic table.
Expand Down Expand Up @@ -90,7 +89,8 @@ public Element(IElement element) {
* @param symbol The element symbol that this element should have.
*/
public Element(String symbol) {
this(symbol, PeriodicTable.getAtomicNumber(symbol));
this();
this.symbol = symbol;
}

/**
Expand All @@ -101,7 +101,7 @@ public Element(String symbol) {
* @param atomicNumber The atomicNumber of this element.
*/
public Element(String symbol, Integer atomicNumber) {
this.symbol = symbol;
this(symbol);
this.atomicNumber = atomicNumber;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1098,15 +1098,4 @@ public void testImplicitH() throws Exception {
Assert.assertEquals("C6H6", MolecularFormulaManipulator.getString(f));

}

/**
* @cdk.bug 1296
*/
@Test public void bug1296() {
IAtomContainer container = MolecularFormulaManipulator.getAtomContainer("C8H10N4O2",
DefaultChemObjectBuilder.getInstance());
for(IAtom a : container.atoms()){
Assert.assertNotNull(a.getAtomicNumber());
}
}
}

0 comments on commit 94f02e5

Please sign in to comment.