org.xmlcml.tools
Class AtomSetImpl
java.lang.Object
|
+--java.util.AbstractCollection
|
+--java.util.AbstractSet
|
+--java.util.HashSet
|
+--org.xmlcml.tools.ToolHashSetImpl
|
+--org.xmlcml.tools.AtomSetImpl
- public class AtomSetImpl
- extends ToolHashSetImpl
- implements AtomSet
a set of atoms. Counts number of times an atom has been added
(e.g. for bonds). An AtomSet may have coordinates associated with it which
may or may not be related to the molecule. This should make calcuation of fragment
geometries easier and therefore assembly less painful
- See Also:
- Serialized Form
| 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 |
coordinate2Map
protected java.util.HashMap coordinate2Map
AtomSetImpl
public AtomSetImpl()
addAtom
public void addAtom(Atom atom)
throws CMLException
- add an atom. If atom already present, increments count
- Specified by:
- addAtom in interface AtomSet
addBond
public void addBond(Bond bond)
throws CMLException
- adds both atoms in the bond
- Specified by:
- addBond in interface AtomSet
and
public AtomSet and(AtomSet atomSet)
throws CMLException
- combines this with AtomSet to find common elements, else null.
- Specified by:
- and in interface AtomSet
xor
public AtomSet xor(AtomSet atomSet)
throws CMLException
- combines this with AtomSet to find elements NOT in common,
else null.
- Specified by:
- xor in interface AtomSet
not
public AtomSet not(AtomSet atomSet)
throws CMLException
- combines this with AtomSet to find elements NOT in AtomSet,
else null.
- Specified by:
- not in interface AtomSet
or
public AtomSet or(AtomSet atomSet)
throws CMLException
- combines this with AtomSet to find all elements.
- Specified by:
- or in interface AtomSet
getCount
public int getCount(Atom atom)
- how many times has atom been added (0 means atom is not in
set
- Specified by:
- getCount in interface AtomSet
clearCoordinate2
public void clearCoordinate2()
- clear atom coordinate table
- Specified by:
- clearCoordinate2 in interface AtomSet
setCoordinate2
public void setCoordinate2(Atom atom,
Coordinate2 c)
throws CMLException
- set coordinates for atom
- Specified by:
- setCoordinate2 in interface AtomSet
getCoordinate2
public Coordinate2 getCoordinate2(Atom atom)
throws CMLException
- get coordinates for atom
- Specified by:
- getCoordinate2 in interface AtomSet
transform
public void transform(Transform2 t2)
- transform coordinates of all atoms in the set (rather inefficient)
- Specified by:
- transform in interface AtomSet
translateBy
public void translateBy(Real2 offset)
- translate coordinates of all atoms in the set
- Specified by:
- translateBy in interface AtomSet
toString
public java.lang.String toString()
- Overrides:
- toString in class java.util.AbstractCollection