/**
  * 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);
     }
   }
 }
 public Object clone() throws CloneNotSupportedException {
   Object clone = null;
   try {
     clone = super.clone();
   } catch (Exception exception) {
     logger.error("Could not clone DebugAtomContainer: " + exception.getMessage(), exception);
     logger.debug(exception);
   }
   return clone;
 }
 /**
  * Procedure required by the CDOInterface. This function is only supposed to be called by the JCFL
  * library
  */
 public void startObject(String objectType) {
   logger.debug("START:" + objectType);
   if (objectType.equals("Molecule")) {
     currentMolecule = builder.newAtomContainer();
     atomEnumeration = new Hashtable<String, Integer>();
   } else if (objectType.equals("Atom")) {
     currentAtom = builder.newAtom("H");
     logger.debug("Atom # " + numberOfAtoms);
     numberOfAtoms++;
   } else if (objectType.equals("Bond")) {
     bond_id = null;
     bond_stereo = -99;
   }
 }
  private IChemFile readChemFile() throws CDKException {
    IChemSequence seq = file.getBuilder().newChemSequence();
    IChemModel model = file.getBuilder().newChemModel();
    IMoleculeSet containerSet = file.getBuilder().newMoleculeSet();
    IMolecule container = file.getBuilder().newMolecule();

    int lineNumber = 0;

    try {
      String line = input.readLine();
      while (input.ready() && line != null) {
        logger.debug((lineNumber++) + ": ", line);
        String command = null;
        if (isCommand(line)) {
          command = getCommand(line);
          int lineCount = getContentLinesCount(line);
          if ("ATOMS".equals(command)) {
            processAtomsBlock(lineCount, container);
          } else if ("BONDS".equals(command)) {
            processBondsBlock(lineCount, container);
          } else if ("IDENT".equals(command)) {
            processIdentBlock(lineCount, container);
          } else if ("NAME".equals(command)) {
            processNameBlock(lineCount, container);
          } else {
            // skip lines
            logger.warn("Dropping block: ", command);
            for (int i = 0; i < lineCount; i++) input.readLine();
          }
        } else {
          logger.warn("Unexpected content at line: ", lineNumber);
        }
        line = input.readLine();
      }
      containerSet.addAtomContainer(container);
      model.setMoleculeSet(containerSet);
      seq.addChemModel(model);
      file.addChemSequence(seq);
    } catch (Exception exception) {
      String message = "Error while parsing CTX file: " + exception.getMessage();
      logger.error(message);
      logger.debug(exception);
      throw new CDKException(message, exception);
    }
    return file;
  }
 public boolean getFlag(int flag_type) {
   logger.debug("Setting flag: ", flag_type + "=" + super.getFlag(flag_type));
   return super.getFlag(flag_type);
 }
 public void setID(String identifier) {
   logger.debug("Setting ID: ", identifier);
   super.setID(identifier);
 }
 public void setFlag(int flag_type, boolean flag_value) {
   logger.debug("Setting flag: ", flag_type + "=" + flag_value);
   super.setFlag(flag_type, flag_value);
 }
 public boolean contains(IBond bond) {
   logger.debug("Contains bond: ", bond);
   return super.contains(bond);
 }
 public String getID() {
   logger.debug("Getting ID: ", super.getID());
   return super.getID();
 }
 public boolean[] getFlags() {
   logger.debug("Getting flags:", super.getFlags().length);
   return super.getFlags();
 }
 public boolean contains(ISingleElectron ec) {
   logger.debug("Contains single electron: ", ec);
   return super.contains(ec);
 }
 public void notifyChanged(IChemObjectChangeEvent evt) {
   logger.debug("Notifying changed event: ", evt);
   super.notifyChanged(evt);
 }
 public void addAtomParity(IAtomParity parity) {
   logger.debug("Adding atom parity: ", parity);
   super.addAtomParity(parity);
 }
 public void removeListener(IChemObjectListener col) {
   logger.debug("Removing listener: ", col);
   super.removeListener(col);
 }
 public void notifyChanged() {
   logger.debug("Notifying changed");
   super.notifyChanged();
 }
 public int getListenerCount() {
   logger.debug("Getting listener count: ", super.getListenerCount());
   return super.getListenerCount();
 }
 public void addListener(IChemObjectListener col) {
   logger.debug("Adding listener: ", col);
   super.addListener(col);
 }
 public boolean contains(IElectronContainer electronContainer) {
   logger.debug("Contains electron container: ", electronContainer);
   return super.contains(electronContainer);
 }
 public void setProperties(Map<Object, Object> properties) {
   logger.debug("Setting properties: ", properties);
   super.setProperties(properties);
 }
 public void setAtoms(IAtom[] atoms) {
   logger.debug("Setting atoms: ", atoms.length);
   super.setAtoms(atoms);
 }
 public void setFlags(boolean[] flagsNew) {
   logger.debug("Setting flags:", flagsNew.length);
   super.setFlags(flagsNew);
 }
 public IAtom getAtom(int number) {
   logger.debug("Getting atom at: ", number);
   return super.getAtom(number);
 }
 public void setProperty(Object description, Object property) {
   logger.debug("Setting property: ", description + "=" + property);
   super.setProperty(description, property);
 }
 public boolean contains(ILonePair ec) {
   logger.debug("Contains lone pair: ", ec);
   return super.contains(ec);
 }
 public IAtomParity getAtomParity(IAtom atom) {
   logger.debug("Getting atom parity: ", atom);
   return super.getAtomParity(atom);
 }
 public void removeProperty(Object description) {
   logger.debug("Removing property: ", description);
   super.removeProperty(description);
 }
 public void setAtom(int number, IAtom atom) {
   logger.debug("Setting atom at: pos=" + number, " atom=" + atom);
   super.setAtom(number, atom);
 }
 public Object getProperty(Object description) {
   logger.debug("Getting property: ", description + "=" + super.getProperty(description));
   return super.getProperty(description);
 }
 public IBond getBond(int number) {
   logger.debug("Getting bond at: ", number);
   return super.getBond(number);
 }
 public Map<Object, Object> getProperties() {
   logger.debug("Getting properties");
   return super.getProperties();
 }