/** * Procedure required by the CDOInterface. This function is only supposed to be called by the JCFL * library */ public void endObject(String objectType) { logger.debug("END: " + objectType); if (objectType.equals("Molecule")) { eventReader.fireFrameRead(); clearData(); } else if (objectType.equals("Atom")) { currentMolecule.addAtom(currentAtom); } else if (objectType.equals("Bond")) { logger.debug("Bond(" + bond_id + "): " + bond_a1 + ", " + bond_a2 + ", " + bond_order); if (bond_a1 > currentMolecule.getAtomCount() || bond_a2 > currentMolecule.getAtomCount()) { logger.error( "Cannot add bond between at least one non-existant atom: " + bond_a1 + " and " + bond_a2); } else { IAtom a1 = currentMolecule.getAtom(bond_a1); IAtom a2 = currentMolecule.getAtom(bond_a2); IBond b = builder.newBond(a1, a2, bond_order); if (bond_id != null) b.setID(bond_id); if (bond_stereo != -99) { b.setStereo(bond_stereo); } currentMolecule.addBond(b); } } }