Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:cdk/cdk
Browse files Browse the repository at this point in the history
  • Loading branch information
rajarshi committed May 20, 2010
2 parents d694d19 + f3f809e commit 6d1a730
Show file tree
Hide file tree
Showing 51 changed files with 1,666 additions and 571 deletions.
8 changes: 6 additions & 2 deletions build.xml
Expand Up @@ -293,14 +293,16 @@
depends="init, check, runDoclet"/>

<target id="qa-module" name="qa-module"
depends="check, dist.init, compile-needed-test"
unless="module-uptodate">
depends="check, dist.init">
<echo message="Running QA for CDK's ${module} module" />

<antcall target="test-module">
<param name="module" value="${module}"/>
</antcall>

<ant antfile="javadoc.xml" target="ojdcheck-module">
<property name="module" value="${module}"/>
</ant>
<ant antfile="pmd.xml" target="test-module">
<property name="pmd.test" value="custom"/>
<property name="module" value="${module}"/>
Expand Down Expand Up @@ -619,6 +621,7 @@
<includesfile name="${metainf}/forcefield.libdepends"/>
<includesfile name="${metainf}/inchi.libdepends"/>
<includesfile name="${metainf}/smarts.libdepends"/>
<includesfile name="${metainf}/smsd.libdepends"/>
<includesfile name="${metainf}/pcore.libdepends"/>
<includesfile name="${metainf}/formula.libdepends"/>
<includesfile name="${metainf}/isomorphism.libdepends"/>
Expand Down Expand Up @@ -667,6 +670,7 @@
<include name="cdk-formula.jar"/>
<include name="cdk-isomorphism.jar"/>
<include name="cdk-ionpot.jar"/>
<include name="cdk-smsd.jar"/>
</fileset>
</unjar>

Expand Down
1 change: 1 addition & 0 deletions src/META-INF/test-interfaces.cdkdepends
Expand Up @@ -2,4 +2,5 @@ cdk-annotation.jar
cdk-interfaces.jar
cdk-core.jar
cdk-diff.jar
cdk-standard.jar
cdk-test.jar
55 changes: 21 additions & 34 deletions src/main/org/openscience/cdk/AtomContainer.java
Expand Up @@ -25,20 +25,18 @@

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IAtomParity;
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IChemObjectChangeEvent;
import org.openscience.cdk.interfaces.IChemObjectListener;
import org.openscience.cdk.interfaces.IElectronContainer;
import org.openscience.cdk.interfaces.ILonePair;
import org.openscience.cdk.interfaces.ISingleElectron;
import org.openscience.cdk.interfaces.IStereoElement;
import org.openscience.cdk.interfaces.IBond.Order;

/**
Expand Down Expand Up @@ -118,10 +116,10 @@ public class AtomContainer extends ChemObject
*/
protected ISingleElectron[] singleElectrons;

/**
* Internal list of atom parities.
*/
protected Map<IAtom, IAtomParity> atomParities;
/**
* Internal list of atom parities.
*/
protected List<IStereoElement> stereoElements;


/**
Expand Down Expand Up @@ -150,7 +148,7 @@ public AtomContainer(IAtomContainer container)
this.lonePairs = new ILonePair[this.lonePairCount];
this.singleElectrons = new ISingleElectron[this.singleElectronCount];

atomParities = new Hashtable<IAtom, IAtomParity>(atomCount/2);
stereoElements = new ArrayList<IStereoElement>(atomCount/2);

for (int f = 0; f < container.getAtomCount(); f++) {
atoms[f] = container.getAtom(f);
Expand Down Expand Up @@ -192,33 +190,22 @@ public AtomContainer(int atomCount, int bondCount, int lpCount, int seCount)
bonds = new IBond[bondCount];
lonePairs = new ILonePair[lpCount];
singleElectrons = new ISingleElectron[seCount];
atomParities = new Hashtable<IAtom, IAtomParity>(atomCount/2);
stereoElements = new ArrayList<IStereoElement>(atomCount/2);
}

/**
* Adds an AtomParity to this container. If a parity is already given for the
* affected Atom, it is overwritten.
*
* @param parity The new AtomParity for this container
* @see #getAtomParity
*/
public void addAtomParity(IAtomParity parity) {
atomParities.put(parity.getAtom(), parity);
/** {@inheritDoc} */
public void addStereoElement(IStereoElement element) {
stereoElements.add(element);
}

/**
* Returns the atom parity for the given Atom. If no parity is associated
* with the given Atom, it returns null.
*
* @param atom Atom for which the parity must be returned
* @return The AtomParity for the given Atom, or null if that Atom does
* not have an associated AtomParity
* @see #addAtomParity
*/
public IAtomParity getAtomParity(IAtom atom) {
return atomParities.get(atom);
/** {@inheritDoc} */
public Iterable<IStereoElement> stereoElements() {
return new Iterable<IStereoElement>() {
public Iterator<IStereoElement> iterator() {
return stereoElements.iterator();
}
};
}

/**
* Sets the array of atoms of this AtomContainer.
*
Expand Down Expand Up @@ -1568,10 +1555,10 @@ public String toString()
stringContent.append(", ").append(getSingleElectron(i).toString());
}
}
if (atomParities.size() > 0) {
stringContent.append(", AP:[#").append(atomParities.size());
for (IAtomParity iAtomParity : atomParities.values()) {
stringContent.append(", ").append(iAtomParity.toString());
if (stereoElements.size() > 0) {
stringContent.append(", ST:[#").append(stereoElements.size());
for (IStereoElement elements : stereoElements) {
stringContent.append(", ").append(elements.toString());
}
stringContent.append(']');
}
Expand Down
8 changes: 3 additions & 5 deletions src/main/org/openscience/cdk/CDKConstants.java
Expand Up @@ -168,14 +168,10 @@ public class CDKConstants {
/** Flag is set if an atom could be typed.
*/
public static final int IS_TYPEABLE = 11;
/** Flag is set in JCP if an arrow indicating move
* should be shown.
*/
public static final int SHOW_MOVE_ARRAY = 12;
/**
* Maximum flags array index.
*/
public final static int MAX_FLAG_INDEX = 13;
public final static int MAX_FLAG_INDEX = 12;
/**
* Flag used for JUnit testing the pointer functionality.
*/
Expand Down Expand Up @@ -295,6 +291,8 @@ public class CDKConstants {
*/
public static final String REST_H = "cdk:RestH";

public static final String ATOM_ATOM_MAPPING = "cdk:AtomAtomMapping";


/* **************************************
* Some predefined property names for *
Expand Down
16 changes: 8 additions & 8 deletions src/main/org/openscience/cdk/debug/DebugAminoAcid.java
Expand Up @@ -27,14 +27,14 @@
import org.openscience.cdk.interfaces.IAminoAcid;
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IAtomParity;
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IChemObjectBuilder;
import org.openscience.cdk.interfaces.IChemObjectChangeEvent;
import org.openscience.cdk.interfaces.IChemObjectListener;
import org.openscience.cdk.interfaces.IElectronContainer;
import org.openscience.cdk.interfaces.ILonePair;
import org.openscience.cdk.interfaces.IChemObjectBuilder;
import org.openscience.cdk.interfaces.ISingleElectron;
import org.openscience.cdk.interfaces.IStereoElement;
import org.openscience.cdk.interfaces.IBond.Order;
import org.openscience.cdk.tools.ILoggingTool;
import org.openscience.cdk.tools.LoggingToolFactory;
Expand All @@ -54,14 +54,14 @@ public class DebugAminoAcid extends AminoAcid
ILoggingTool logger =
LoggingToolFactory.createLoggingTool(DebugAtomContainer.class);

public void addAtomParity(IAtomParity parity) {
logger.debug("Adding atom parity: ", parity);
super.addAtomParity(parity);
public void addStereoElement(IStereoElement parity) {
logger.debug("Adding stereo element: ", parity);
super.addStereoElement(parity);
}

public IAtomParity getAtomParity(IAtom atom) {
logger.debug("Getting atom parity: ", atom);
return super.getAtomParity(atom);
public Iterable<IStereoElement> stereoElements() {
logger.debug("Getting stereo elements.");
return super.stereoElements();
}

public void setAtoms(IAtom[] atoms) {
Expand Down
20 changes: 10 additions & 10 deletions src/main/org/openscience/cdk/debug/DebugAtomContainer.java
Expand Up @@ -26,14 +26,14 @@
import org.openscience.cdk.AtomContainer;
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IAtomParity;
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IChemObjectBuilder;
import org.openscience.cdk.interfaces.IChemObjectChangeEvent;
import org.openscience.cdk.interfaces.IChemObjectListener;
import org.openscience.cdk.interfaces.IElectronContainer;
import org.openscience.cdk.interfaces.ILonePair;
import org.openscience.cdk.interfaces.IChemObjectBuilder;
import org.openscience.cdk.interfaces.ISingleElectron;
import org.openscience.cdk.interfaces.IStereoElement;
import org.openscience.cdk.interfaces.IBond.Order;
import org.openscience.cdk.tools.ILoggingTool;
import org.openscience.cdk.tools.LoggingToolFactory;
Expand Down Expand Up @@ -65,15 +65,15 @@ public DebugAtomContainer(IAtomContainer container) {
super(container);
}

public void addAtomParity(IAtomParity parity) {
logger.debug("Adding atom parity: ", parity);
super.addAtomParity(parity);
}
public void addStereoElement(IStereoElement parity) {
logger.debug("Adding stereo element: ", parity);
super.addStereoElement(parity);
}

public IAtomParity getAtomParity(IAtom atom) {
logger.debug("Getting atom parity: ", atom);
return super.getAtomParity(atom);
}
public Iterable<IStereoElement> stereoElements() {
logger.debug("Getting stereo elements.");
return super.stereoElements();
}

public void setAtoms(IAtom[] atoms) {
logger.debug("Setting atoms: ", atoms.length);
Expand Down
20 changes: 10 additions & 10 deletions src/main/org/openscience/cdk/debug/DebugBioPolymer.java
Expand Up @@ -27,16 +27,16 @@
import org.openscience.cdk.BioPolymer;
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IAtomParity;
import org.openscience.cdk.interfaces.IBioPolymer;
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IChemObjectBuilder;
import org.openscience.cdk.interfaces.IChemObjectChangeEvent;
import org.openscience.cdk.interfaces.IChemObjectListener;
import org.openscience.cdk.interfaces.IElectronContainer;
import org.openscience.cdk.interfaces.ILonePair;
import org.openscience.cdk.interfaces.IMonomer;
import org.openscience.cdk.interfaces.IChemObjectBuilder;
import org.openscience.cdk.interfaces.ISingleElectron;
import org.openscience.cdk.interfaces.IStereoElement;
import org.openscience.cdk.interfaces.IStrand;
import org.openscience.cdk.interfaces.IBond.Order;
import org.openscience.cdk.tools.ILoggingTool;
Expand All @@ -57,15 +57,15 @@ public class DebugBioPolymer extends BioPolymer
ILoggingTool logger =
LoggingToolFactory.createLoggingTool(DebugAtomContainer.class);

public void addAtomParity(IAtomParity parity) {
logger.debug("Adding atom parity: ", parity);
super.addAtomParity(parity);
}
public void addStereoElement(IStereoElement parity) {
logger.debug("Adding stereo element: ", parity);
super.addStereoElement(parity);
}

public IAtomParity getAtomParity(IAtom atom) {
logger.debug("Getting atom parity: ", atom);
return super.getAtomParity(atom);
}
public Iterable<IStereoElement> stereoElements() {
logger.debug("Getting stereo elements.");
return super.stereoElements();
}

public void setAtoms(IAtom[] atoms) {
logger.debug("Setting atoms: ", atoms.length);
Expand Down
20 changes: 10 additions & 10 deletions src/main/org/openscience/cdk/debug/DebugCrystal.java
Expand Up @@ -28,15 +28,15 @@
import org.openscience.cdk.Crystal;
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IAtomParity;
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IChemObjectBuilder;
import org.openscience.cdk.interfaces.IChemObjectChangeEvent;
import org.openscience.cdk.interfaces.IChemObjectListener;
import org.openscience.cdk.interfaces.ICrystal;
import org.openscience.cdk.interfaces.IElectronContainer;
import org.openscience.cdk.interfaces.ILonePair;
import org.openscience.cdk.interfaces.IChemObjectBuilder;
import org.openscience.cdk.interfaces.ISingleElectron;
import org.openscience.cdk.interfaces.IStereoElement;
import org.openscience.cdk.interfaces.IBond.Order;
import org.openscience.cdk.tools.ILoggingTool;
import org.openscience.cdk.tools.LoggingToolFactory;
Expand Down Expand Up @@ -64,15 +64,15 @@ public DebugCrystal(IAtomContainer container) {
super(container);
}

public void addAtomParity(IAtomParity parity) {
logger.debug("Adding atom parity: ", parity);
super.addAtomParity(parity);
}
public void addStereoElement(IStereoElement parity) {
logger.debug("Adding stereo element: ", parity);
super.addStereoElement(parity);
}

public IAtomParity getAtomParity(IAtom atom) {
logger.debug("Getting atom parity: ", atom);
return super.getAtomParity(atom);
}
public Iterable<IStereoElement> stereoElements() {
logger.debug("Getting stereo elements.");
return super.stereoElements();
}

public void setAtoms(IAtom[] atoms) {
logger.debug("Setting atoms: ", atoms.length);
Expand Down
20 changes: 10 additions & 10 deletions src/main/org/openscience/cdk/debug/DebugMolecule.java
Expand Up @@ -26,15 +26,15 @@
import org.openscience.cdk.Molecule;
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IAtomParity;
import org.openscience.cdk.interfaces.IBond;
import org.openscience.cdk.interfaces.IChemObjectBuilder;
import org.openscience.cdk.interfaces.IChemObjectChangeEvent;
import org.openscience.cdk.interfaces.IChemObjectListener;
import org.openscience.cdk.interfaces.IElectronContainer;
import org.openscience.cdk.interfaces.ILonePair;
import org.openscience.cdk.interfaces.IMolecule;
import org.openscience.cdk.interfaces.IChemObjectBuilder;
import org.openscience.cdk.interfaces.ISingleElectron;
import org.openscience.cdk.interfaces.IStereoElement;
import org.openscience.cdk.interfaces.IBond.Order;
import org.openscience.cdk.tools.ILoggingTool;
import org.openscience.cdk.tools.LoggingToolFactory;
Expand Down Expand Up @@ -66,15 +66,15 @@ public DebugMolecule(IAtomContainer container) {
super(container);
}

public void addAtomParity(IAtomParity parity) {
logger.debug("Adding atom parity: ", parity);
super.addAtomParity(parity);
}
public void addStereoElement(IStereoElement parity) {
logger.debug("Adding stereo element: ", parity);
super.addStereoElement(parity);
}

public IAtomParity getAtomParity(IAtom atom) {
logger.debug("Getting atom parity: ", atom);
return super.getAtomParity(atom);
}
public Iterable<IStereoElement> stereoElements() {
logger.debug("Getting stereo elements.");
return super.stereoElements();
}

public void setAtoms(IAtom[] atoms) {
logger.debug("Setting atoms: ", atoms.length);
Expand Down

0 comments on commit 6d1a730

Please sign in to comment.