/** * True, if the AtomContainer contains the given bond object. * *@param bond the bond this AtomContainer is searched for *@return true if the AtomContainer contains the given bond object */ @Override public boolean contains(IBond bond) { for (int i = 0; i < getBondCount(); i++) { if (bonds[i].equals(bond)) return true; } return false; }
/** * Returns the bond that connects the two given atoms. * * @param atom1 The first atom * @param atom2 The second atom * @return The bond that connects the two atoms */ @Override public IBond getBond(IAtom atom1, IAtom atom2) { for (int i = 0; i < getBondCount(); i++) { if (bonds[i].contains(atom1) && bonds[i].getOther(atom1).equals(atom2)) { return bonds[i]; } } return null; }
@Override public String toString() { StringBuilder s = new StringBuilder(); s.append("QueryAtomContainer("); s.append(this.hashCode()); s.append(", #A:").append(getAtomCount()); s.append(", #EC:").append(getElectronContainerCount()); for (int i = 0; i < getAtomCount(); i++) { s.append(", ").append(getAtom(i).toString()); } for (int i = 0; i < getBondCount(); i++) { s.append(", ").append(getBond(i).toString()); } for (int i = 0; i < getLonePairCount(); i++) { s.append(", ").append(getLonePair(i).toString()); } for (int i = 0; i < getSingleElectronCount(); i++) { s.append(", ").append(getSingleElectron(i).toString()); } s.append(')'); return s.toString(); }
/** * Removes all Bonds from this container. */ @Override public void removeAllBonds() { for (int f = 0; f < getBondCount(); f++) { getBond(f).removeListener(this); } bonds = new IBond[growArraySize]; bondCount = 0; notifyChanged(); }
for (int i = 0; i < getBondCount(); ++i) { bond = getBond(i); newBond = (IBond) bond.clone();