/** * {@inheritDoc} */ @Override public IAtomContainer newAtomContainer() { if (CDK_LEGACY_AC) return new AtomContainer(0,0,0,0); else return new AtomContainer2(0,0,0,0); } }
stringContent.append("AtomContainer("); stringContent.append(this.hashCode()); if (getAtomCount() > 0) { stringContent.append(", #A:").append(getAtomCount()); for (int i = 0; i < getAtomCount(); i++) { stringContent.append(", ").append(getAtom(i).toString()); if (getBondCount() > 0) { stringContent.append(", #B:").append(getBondCount()); for (int i = 0; i < getBondCount(); i++) { stringContent.append(", ").append(getBond(i).toString()); if (getLonePairCount() > 0) { stringContent.append(", #LP:").append(getLonePairCount()); for (int i = 0; i < getLonePairCount(); i++) { stringContent.append(", ").append(getLonePair(i).toString()); if (getSingleElectronCount() > 0) { stringContent.append(", #SE:").append(getSingleElectronCount()); for (int i = 0; i < getSingleElectronCount(); i++) { stringContent.append(", ").append(getSingleElectron(i).toString());
/** * * Adds the atom oAtom to a specific Monomer. * * @param oAtom The atom to add * @param oMonomer The monomer the atom belongs to * */ @Override public void addAtom(IAtom oAtom, IMonomer oMonomer) { int atomCount = super.getAtomCount(); // Add atom to AtomContainer super.addAtom(oAtom); if (atomCount != super.getAtomCount()) { // ok, super did not yet contain the atom if (oMonomer == null) { oMonomer = getMonomer(""); } oMonomer.addAtom(oAtom); if (!monomers.containsKey(oMonomer.getMonomerName())) { monomers.put(oMonomer.getMonomerName(), oMonomer); } } }
/** * {@inheritDoc} */ @Override public void addElectronContainer(IElectronContainer electronContainer) { if (electronContainer instanceof IBond) this.addBond((IBond) electronContainer); if (electronContainer instanceof ILonePair) this.addLonePair((ILonePair) electronContainer); if (electronContainer instanceof ISingleElectron) this.addSingleElectron((ISingleElectron) electronContainer); }
/** * {@inheritDoc} */ @Override public void addBond(int atom1, int atom2, IBond.Order order, IBond.Stereo stereo) { IBond bond = getBuilder().newInstance(IBond.class, getAtom(atom1), getAtom(atom2), order, stereo); addBond(bond); }
final MDLV2000Reader mdlv2000Reader = new MDLV2000Reader(new ByteArrayInputStream(mol.getBytes(StandardCharsets.UTF_8))); mdlv2000Reader.setReaderMode(IChemObjectReader.Mode.RELAXED); final org.openscience.cdk.silent.AtomContainer atomContainer = mdlv2000Reader.read(new org.openscience.cdk.silent.AtomContainer()); Assert.assertEquals(17, atomContainer.getAtomCount());
/** * {@inheritDoc} */ @Override public IAtom getLastAtom() { return getAtomCount() > 0 ? (IAtom) atoms[getAtomCount() - 1] : null; }
/** * Adds the atom oAtom to a specified Monomer. * * @param oAtom The atom to add * @param oMonomer The monomer the atom belongs to */ @Override public void addAtom(IAtom oAtom, IMonomer oMonomer) { if (!contains(oAtom)) { super.addAtom(oAtom); if (oMonomer != null) { // Not sure what's better here...throw nullpointer exception? oMonomer.addAtom(oAtom); if (!monomers.containsKey(oMonomer.getMonomerName())) { monomers.put(oMonomer.getMonomerName(), oMonomer); } } } /* * notifyChanged() is called by addAtom in AtomContainer */ }
/** * {@inheritDoc} */ @Override public void addBond(int atom1, int atom2, IBond.Order order) { IBond bond = getBuilder().newInstance(IBond.class, getAtom(atom1), getAtom(atom2), order); addBond(bond); }
/** * {@inheritDoc} */ @Override public void addElectronContainer(IElectronContainer electronContainer) { if (electronContainer instanceof IBond) this.addBond((IBond) electronContainer); if (electronContainer instanceof ILonePair) this.addLonePair((ILonePair) electronContainer); if (electronContainer instanceof ISingleElectron) this.addSingleElectron((ISingleElectron) electronContainer); }
/** * {@inheritDoc} */ @Override public IAtom getLastAtom() { return getAtomCount() > 0 ? (IAtom) atoms[getAtomCount() - 1] : null; }
/** * Adds the atom oAtom to a specified Monomer. * * @param oAtom The atom to add * @param oMonomer The monomer the atom belongs to */ @Override public void addAtom(IAtom oAtom, IMonomer oMonomer) { if (!contains(oAtom)) { super.addAtom(oAtom); if (oMonomer != null) { // Not sure what's better here...throw nullpointer exception? oMonomer.addAtom(oAtom); if (!monomers.containsKey(oMonomer.getMonomerName())) { monomers.put(oMonomer.getMonomerName(), oMonomer); } } } /* * notifyChanged() is called by addAtom in AtomContainer */ }
@Override public IChemObject newTestObject() { return new AtomContainer(); } });
stringContent.append("AtomContainer("); stringContent.append(this.hashCode()); if (getAtomCount() > 0) { stringContent.append(", #A:").append(getAtomCount()); for (int i = 0; i < getAtomCount(); i++) { stringContent.append(", ").append(getAtom(i).toString()); if (getBondCount() > 0) { stringContent.append(", #B:").append(getBondCount()); for (int i = 0; i < getBondCount(); i++) { stringContent.append(", ").append(getBond(i).toString()); if (getLonePairCount() > 0) { stringContent.append(", #LP:").append(getLonePairCount()); for (int i = 0; i < getLonePairCount(); i++) { stringContent.append(", ").append(getLonePair(i).toString()); if (getSingleElectronCount() > 0) { stringContent.append(", #SE:").append(getSingleElectronCount()); for (int i = 0; i < getSingleElectronCount(); i++) { stringContent.append(", ").append(getSingleElectron(i).toString());
/** * {@inheritDoc} */ @Override public void addBond(int atom1, int atom2, IBond.Order order) { IBond bond = getBuilder().newInstance(IBond.class, getAtom(atom1), getAtom(atom2), order); addBond(bond); }
/** * * Adds the atom oAtom to a specific Monomer. * * @param oAtom The atom to add * @param oMonomer The monomer the atom belongs to * */ @Override public void addAtom(IAtom oAtom, IMonomer oMonomer) { int atomCount = super.getAtomCount(); // Add atom to AtomContainer super.addAtom(oAtom); if (atomCount != super.getAtomCount()) { // ok, super did not yet contain the atom if (oMonomer == null) { oMonomer = getMonomer(""); } oMonomer.addAtom(oAtom); if (!monomers.containsKey(oMonomer.getMonomerName())) { monomers.put(oMonomer.getMonomerName(), oMonomer); } } }
/** * {@inheritDoc} */ @Override public boolean contains(IAtom atom) { for (int i = 0; i < getAtomCount(); i++) { if (atoms[i].equals(atom)) return true; } return false; }
/** * {@inheritDoc} */ @Override public IAtomContainer newAtomContainer() { if (CDK_LEGACY_AC) return new AtomContainer(0,0,0,0); else return new AtomContainer2(0,0,0,0); } }
/** * {@inheritDoc} */ @Override public void addBond(int atom1, int atom2, IBond.Order order, IBond.Stereo stereo) { IBond bond = getBuilder().newInstance(IBond.class, getAtom(atom1), getAtom(atom2), order, stereo); addBond(bond); }
/** * {@inheritDoc} */ @Override public boolean contains(IAtom atom) { for (int i = 0; i < getAtomCount(); i++) { if (atoms[i].equals(atom)) return true; } return false; }