/** * Returns the String representation of this RingSet. * * @return The String representation of this RingSet */ @Override public String toString() { StringBuffer buffer = new StringBuffer(32); buffer.append("RingSet("); buffer.append(this.hashCode()); if (getAtomContainerCount() > 0) { buffer.append(", R=").append(getAtomContainerCount()).append(", "); for (int i = 0; i < atomContainerCount; i++) { IRing possibleRing = (IRing) atomContainers[i]; buffer.append(possibleRing.toString()); if (i + 1 < atomContainerCount) { buffer.append(", "); } } } buffer.append(')'); return buffer.toString(); }
/** * Checks for presence of a ring in this RingSet. * * @param ring The ring to check * @return true if ring is part of RingSet * */ @Override public boolean contains(IAtomContainer ring) { for (int i = 0; i < getAtomContainerCount(); i++) { if (ring == getAtomContainer(i)) { return true; } } return false; }
/** * Checks for presence of a ring in this RingSet. * * @param ring The ring to check * @return true if ring is part of RingSet * */ @Override public boolean contains(IAtomContainer ring) { for (int i = 0; i < getAtomContainerCount(); i++) { if (ring == getAtomContainer(i)) { return true; } } return false; }
/** * Returns the String representation of this RingSet. * * @return The String representation of this RingSet */ @Override public String toString() { StringBuffer buffer = new StringBuffer(32); buffer.append("RingSet("); buffer.append(this.hashCode()); if (getAtomContainerCount() > 0) { buffer.append(", R=").append(getAtomContainerCount()).append(", "); for (int i = 0; i < atomContainerCount; i++) { IRing possibleRing = (IRing) atomContainers[i]; buffer.append(possibleRing.toString()); if (i + 1 < atomContainerCount) { buffer.append(", "); } } } buffer.append(')'); return buffer.toString(); }
/** * True, if at least one of the rings in the ringset contains * the given atom. * * @param atom Atom to check * @return true, if the ringset contains the atom */ @Override public boolean contains(IAtom atom) { for (int i = 0; i < getAtomContainerCount(); i++) { if (getAtomContainer(i).contains(atom)) { return true; } } return false; }
/** * True, if at least one of the rings in the ringset contains * the given atom. * * @param atom Atom to check * @return true, if the ringset contains the atom */ @Override public boolean contains(IAtom atom) { for (int i = 0; i < getAtomContainerCount(); i++) { if (getAtomContainer(i).contains(atom)) { return true; } } return false; }
/** * Returns a vector of all rings that this atom is part of. * * @param atom The atom to be checked * @return A vector of all rings that this bond is part of */ @Override public IRingSet getRings(IAtom atom) { IRingSet rings = new RingSet(); IRing ring; for (int i = 0; i < getAtomContainerCount(); i++) { ring = (Ring) getAtomContainer(i); if (ring.contains(atom)) { rings.addAtomContainer(ring); } } return rings; }
/** * Returns a vector of all rings that this atom is part of. * * @param atom The atom to be checked * @return A vector of all rings that this bond is part of */ @Override public IRingSet getRings(IAtom atom) { IRingSet rings = new RingSet(); IRing ring; for (int i = 0; i < getAtomContainerCount(); i++) { ring = (Ring) getAtomContainer(i); if (ring.contains(atom)) { rings.addAtomContainer(ring); } } return rings; }
/** * Returns a vector of all rings that this bond is part of. * * @param bond The bond to be checked * @return A vector of all rings that this bond is part of */ @Override public IRingSet getRings(IBond bond) { IRingSet rings = bond.getBuilder().newInstance(IRingSet.class); Ring ring; for (int i = 0; i < getAtomContainerCount(); i++) { ring = (Ring) getAtomContainer(i); if (ring.contains(bond)) { rings.addAtomContainer(ring); } } return rings; }
/** * Returns a vector of all rings that this bond is part of. * * @param bond The bond to be checked * @return A vector of all rings that this bond is part of */ @Override public IRingSet getRings(IBond bond) { IRingSet rings = bond.getBuilder().newInstance(IRingSet.class); Ring ring; for (int i = 0; i < getAtomContainerCount(); i++) { ring = (Ring) getAtomContainer(i); if (ring.contains(bond)) { rings.addAtomContainer(ring); } } return rings; }
/** * Returns all the rings in the RingSet that share * one or more atoms with a given ring. * * @param ring A ring with which all return rings must share one or more atoms * @return All the rings that share one or more atoms with a given ring. */ @Override public IRingSet getConnectedRings(IRing ring) { IRingSet connectedRings = ring.getBuilder().newInstance(IRingSet.class); IRing tempRing; IAtom atom; for (int i = 0; i < ring.getAtomCount(); i++) { atom = ring.getAtom(i); for (int j = 0; j < getAtomContainerCount(); j++) { tempRing = (IRing) getAtomContainer(j); if (tempRing != ring && !connectedRings.contains(tempRing) && tempRing.contains(atom)) { connectedRings.addAtomContainer(tempRing); } } } return connectedRings; }
/** * Returns all the rings in the RingSet that share * one or more atoms with a given ring. * * @param ring A ring with which all return rings must share one or more atoms * @return All the rings that share one or more atoms with a given ring. */ @Override public IRingSet getConnectedRings(IRing ring) { IRingSet connectedRings = ring.getBuilder().newInstance(IRingSet.class); IRing tempRing; IAtom atom; for (int i = 0; i < ring.getAtomCount(); i++) { atom = ring.getAtom(i); for (int j = 0; j < getAtomContainerCount(); j++) { tempRing = (IRing) getAtomContainer(j); if (tempRing != ring && !connectedRings.contains(tempRing) && tempRing.contains(atom)) { connectedRings.addAtomContainer(tempRing); } } } return connectedRings; }