Skip to content

Commit

Permalink
Resolve #523 17 Flip instanceof conditions and use ArrayList instead …
Browse files Browse the repository at this point in the history
…of Vector.
  • Loading branch information
johnmay committed Jan 2, 2019
1 parent bc85e4e commit cb87b11
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
Expand Down Expand Up @@ -152,7 +153,7 @@ public void write(IChemObject object) throws CDKException {
channelElement.appendChild(itemsElement);
channelElement.addAttribute(new Attribute("rdf:about", NS_RDF, about));
rdfElement.appendChild(channelElement);
List list = new Vector();
List<IChemObject> list = new ArrayList<>();
if (object instanceof IAtomContainerSet) {
for (int i = 0; i < ((IAtomContainerSet) object).getAtomContainerCount(); i++) {
list.add(((IAtomContainerSet) object).getAtomContainer(i));
Expand Down Expand Up @@ -199,11 +200,11 @@ public void write(IChemObject object) throws CDKException {
}
Element root = null;
Convertor convertor = new Convertor(true, null);
object = (IChemObject) list.get(i);
if (object instanceof IAtomContainer) {
root = convertor.cdkAtomContainerToCMLMolecule((IAtomContainer) object);
} else if (object instanceof ICrystal) {
object = list.get(i);
if (object instanceof ICrystal) {
root = convertor.cdkCrystalToCMLMolecule((ICrystal) object);
} else if (object instanceof IAtomContainer) {
root = convertor.cdkAtomContainerToCMLMolecule((IAtomContainer) object);
} else if (object instanceof IAtom) {
root = convertor.cdkAtomToCMLAtom(null, (IAtom) object);
} else if (object instanceof IBond) {
Expand Down

0 comments on commit cb87b11

Please sign in to comment.