org.xmlcml.tools
Class RingImpl

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractSet
              |
              +--java.util.HashSet
                    |
                    +--org.xmlcml.tools.ToolHashSetImpl
                          |
                          +--org.xmlcml.tools.BondSetImpl
                                |
                                +--org.xmlcml.tools.RingImpl

public class RingImpl
extends BondSetImpl
implements Ring

See Also:
Serialized Form

Field Summary
protected  CyclicVector cyclicAtomVector
          ordered list of atoms - each element is an Atom as we traverse the Ring cyclicly.
protected  CyclicVector cyclicBondVector
          ordered list of bonds - each element is a Bond and links to the next bond in the ring cyclicly
protected  java.lang.String id
          each ring has a unique ID
protected  java.util.Vector ringOverlapVector
          what rings does this overlap with (FUSED or BRIDGED)? Vector stores RingOverlaps
 
Fields inherited from class org.xmlcml.tools.BondSetImpl
atomSet
 
Constructor Summary
RingImpl()
           
RingImpl(Molecule molecule)
           
 
Method Summary
 void addBond(Bond bond)
          add a bond, checking for nullity and duplicates
 void addRingOverlap(RingOverlap ringOverlap)
          stores knowledge of what rings are neighbours
 BondSet and(Ring ring)
          create a new ring as the AND of this and ring (i.e.
 void calculateCoordinates(Real2 repelPoint)
          calculate coordinates of a ring through two points.
 void calculateCoordinates(Ring overlapRing)
          stores knowledge of what rings are neighbours ?????
 Real2 getCentroid()
           
 java.util.Vector getCyclicAtomVector()
          returns an ordered list of atoms corresponding to traversal of the ring
 java.util.Vector getCyclicBondVector()
          ordered cycle of bonds (e.g.
 java.lang.String getId()
           
 java.util.Vector getRingOverlapVector()
           
static void main(java.lang.String[] args)
           
 java.lang.String toString()
          a String representation (mainly for diagnostics)
 Ring xor(Ring ring)
          create a new ring as the XOR of this and ring (i.e.
 
Methods inherited from class org.xmlcml.tools.BondSetImpl
and, containsAtom, getAtomSet, not, or, xor
 
Methods inherited from class org.xmlcml.tools.ToolHashSetImpl
and, clone, debug, not, or, xor
 
Methods inherited from class java.util.HashSet
add, clear, contains, isEmpty, iterator, remove, size
 
Methods inherited from class java.util.AbstractSet
equals, hashCode
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, removeAll, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

cyclicAtomVector

protected CyclicVector cyclicAtomVector
ordered list of atoms - each element is an Atom as we traverse the Ring cyclicly.

cyclicBondVector

protected CyclicVector cyclicBondVector
ordered list of bonds - each element is a Bond and links to the next bond in the ring cyclicly

ringOverlapVector

protected java.util.Vector ringOverlapVector
what rings does this overlap with (FUSED or BRIDGED)? Vector stores RingOverlaps

id

protected java.lang.String id
each ring has a unique ID
Constructor Detail

RingImpl

public RingImpl()

RingImpl

public RingImpl(Molecule molecule)
Method Detail

addBond

public void addBond(Bond bond)
             throws CMLException
Description copied from interface: BondSet
add a bond, checking for nullity and duplicates
Specified by:
addBond in interface Ring
Overrides:
addBond in class BondSetImpl

getRingOverlapVector

public java.util.Vector getRingOverlapVector()
Specified by:
getRingOverlapVector in interface Ring

getId

public java.lang.String getId()
Specified by:
getId in interface Ring

xor

public Ring xor(Ring ring)
create a new ring as the XOR of this and ring (i.e. formed from bonds NOT in common)
Specified by:
xor in interface Ring

and

public BondSet and(Ring ring)
create a new ring as the AND of this and ring (i.e. formed from bonds in common)
Specified by:
and in interface Ring

getCyclicBondVector

public java.util.Vector getCyclicBondVector()
ordered cycle of bonds (e.g. for creating Polygon). Starts at bond, if bond is part of ring, else arbitrary point. The second bond contains bond.atom2 and so on.
Specified by:
getCyclicBondVector in interface Ring

getCyclicAtomVector

public java.util.Vector getCyclicAtomVector()
returns an ordered list of atoms corresponding to traversal of the ring
Specified by:
getCyclicAtomVector in interface Ring

addRingOverlap

public void addRingOverlap(RingOverlap ringOverlap)
stores knowledge of what rings are neighbours
Specified by:
addRingOverlap in interface Ring

calculateCoordinates

public void calculateCoordinates(Ring overlapRing)
Description copied from interface: Ring
stores knowledge of what rings are neighbours ?????
Specified by:
calculateCoordinates in interface Ring

calculateCoordinates

public void calculateCoordinates(Real2 repelPoint)
calculate coordinates of a ring through two points. If offset = 0 or 1 these points are assumed to be adjacent, else the separation is by offset number of atoms (e.g. offset = 2 implies point[0] and point[2]). The result is an arrary of Points which is NOT applied to the coordinate table.
Specified by:
calculateCoordinates in interface Ring

getCentroid

public Real2 getCentroid()
Specified by:
getCentroid in interface Ring

toString

public java.lang.String toString()
a String representation (mainly for diagnostics)
Overrides:
toString in class BondSetImpl

main

public static void main(java.lang.String[] args)