/** * 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(); }
/** * Returns the position of the bond between two given atoms in the * electronContainers array. It returns -1 if the bond does not exist. * *@param atom1 The first atom *@param atom2 The second atom *@return The Position of the bond between a1 and a2 in the * electronContainers array. */ @Override public int getBondNumber(IAtom atom1, IAtom atom2) { return indexOf(getBond(atom1, atom2)); }
@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 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 removeBond(IAtom atom1, IAtom atom2) { int pos = indexOf(getBond(atom1, atom2)); IBond bond = null; if (pos != -1) { bond = bonds[pos]; removeBond(pos); } return bond; }
IBond newBond; for (int i = 0; i < getBondCount(); ++i) { bond = getBond(i); newBond = (IBond) bond.clone(); newAtoms = new IAtom[bond.getAtomCount()];