/** * {@inheritDoc} */ @Override public IAtom getLastAtom() { return getAtomCount() > 0 ? (IAtom) atoms[getAtomCount() - 1] : null; }
/** * {@inheritDoc} */ @Override public IAtom getLastAtom() { return getAtomCount() > 0 ? (IAtom) atoms[getAtomCount() - 1] : null; }
/** * {@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 boolean contains(IAtom atom) { for (int i = 0; i < getAtomCount(); i++) { if (atoms[i].equals(atom)) return true; } return false; }
/** * {@inheritDoc} */ @Override public int getAtomCount() { logger.debug("Getting atom count"); return super.getAtomCount(); }
/** * * 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); } } }
/** * * 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); } } }
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());
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());
/** * {@inheritDoc} */ @Override public void removeAllElements() { removeAllElectronContainers(); for (int f = 0; f < getAtomCount(); f++) { getAtom(f).removeListener(this); } atoms = new IAtom[growArraySize]; atomCount = 0; stereoElements.clear(); notifyChanged(); }
/** * {@inheritDoc} */ @Override public void removeAllElements() { removeAllElectronContainers(); for (int f = 0; f < getAtomCount(); f++) { getAtom(f).removeListener(this); } atoms = new IAtom[growArraySize]; atomCount = 0; stereoElements.clear(); notifyChanged(); }
CircularFingerprinter.FP[] validateFCFP = parseValidation(content.get(basefn + ".fcfp")); logger.info("FN=" + basefn + " MOL=" + mol.getAtomCount() + "," + mol.getBondCount() + " Requires ECFP=" + validateECFP.length + " FCFP=" + validateFCFP.length);
int wantAromBlocks = Integer.parseInt(bits[3]); logger.info("FN=" + basefn + " MOL=" + mol.getAtomCount() + "," + mol.getBondCount() + " nSmallRings=" + wantSmallRings + " nRingBlocks=" + wantRingBlocks + " nAromRings=" + wantAromRings + " nAromBlocks=" + wantAromBlocks);
@Test public void testConfigureAtoms_IAtomContainer() throws Exception { AtomContainer container = new org.openscience.cdk.AtomContainer(); container.addAtom(new Atom("C")); container.addAtom(new Atom("H")); container.addAtom(new Atom("N")); container.addAtom(new Atom("O")); container.addAtom(new Atom("F")); container.addAtom(new Atom("Cl")); Isotopes isofac = Isotopes.getInstance(); isofac.configureAtoms(container); for (int i = 0; i < container.getAtomCount(); i++) { Assert.assertTrue(0 < container.getAtom(i).getAtomicNumber()); } }
@Test public void testConfigureAtoms_IAtomContainer() throws Exception { AtomContainer container = new org.openscience.cdk.AtomContainer(); container.addAtom(new Atom("C")); container.addAtom(new Atom("H")); container.addAtom(new Atom("N")); container.addAtom(new Atom("O")); container.addAtom(new Atom("F")); container.addAtom(new Atom("Cl")); XMLIsotopeFactory isofac = XMLIsotopeFactory.getInstance(new ChemObject().getBuilder()); isofac.configureAtoms(container); for (int i = 0; i < container.getAtomCount(); i++) { Assert.assertTrue(0 < container.getAtom(i).getAtomicNumber()); } }
@Test public void testAtomPermutation() { AtomContainer ac = new org.openscience.cdk.AtomContainer(); AtomContainer result; String atoms = new String(""); ac.addAtom(new Atom("C")); ac.addAtom(new Atom("N")); ac.addAtom(new Atom("P")); ac.addAtom(new Atom("O")); ac.addAtom(new Atom("S")); ac.addAtom(new Atom("Br")); ac.addBond(0, 1, IBond.Order.SINGLE); ac.addBond(1, 2, IBond.Order.SINGLE); ac.addBond(2, 3, IBond.Order.SINGLE); ac.addBond(3, 4, IBond.Order.SINGLE); ac.addBond(4, 5, IBond.Order.SINGLE); AtomContainerAtomPermutor acap = new AtomContainerAtomPermutor(ac); int counter = 0; while (acap.hasNext()) { counter++; atoms = ""; result = (AtomContainer) acap.next(); for (int f = 0; f < result.getAtomCount(); f++) { atoms += result.getAtom(f).getSymbol(); } } Assert.assertEquals(719, counter); }