Package org.openscience.cdk.debug
Class DebugBond
- java.lang.Object
-
- org.openscience.cdk.ChemObject
-
- org.openscience.cdk.ElectronContainer
-
- org.openscience.cdk.Bond
-
- org.openscience.cdk.debug.DebugBond
-
- All Implemented Interfaces:
Serializable
,Cloneable
,IBond
,ICDKObject
,IChemObject
,IElectronContainer
public class DebugBond extends Bond implements IBond
Debugging data class.- Author:
- egonw
- See Also:
- Serialized Form
- Source code:
- main
- Belongs to CDK module:
- datadebug
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.openscience.cdk.interfaces.IBond
IBond.Display, IBond.Order, IBond.Stereo
-
-
Field Summary
-
Fields inherited from class org.openscience.cdk.ElectronContainer
electronCount
-
Fields inherited from interface org.openscience.cdk.interfaces.IChemObject
ALIPHATIC, AROMATIC, CONJUGATED, HYDROGEN_BOND_ACCEPTOR, HYDROGEN_BOND_DONOR, IN_RING, MAPPED, NOT_IN_RING, PLACED, REACTIVE_CENTER, SINGLE_OR_DOUBLE, TYPEABLE, VISITED
-
-
Constructor Summary
Constructors Constructor Description DebugBond()
DebugBond(IAtom[] atoms)
DebugBond(IAtom[] atoms, IBond.Order order)
DebugBond(IAtom atom1, IAtom atom2)
DebugBond(IAtom atom1, IAtom atom2, IBond.Order order)
DebugBond(IAtom atom1, IAtom atom2, IBond.Order order, IBond.Stereo stereo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(IChemObjectListener col)
Use this to add yourself to this IChemObject as a listener.void
addProperties(Map<Object,Object> properties)
Sets the properties of this object.Iterable<IAtom>
atoms()
Returns the Iterator to atoms making up this bond.IBond
clone()
Clones this bond object, including clones of the atoms between which the bond is defined.boolean
compare(Object object)
Compares a bond with this bond.boolean
contains(IAtom atom)
Returns true if the given atom participates in this bond.javax.vecmath.Point2d
get2DCenter()
Returns the geometric 2D center of the bond.javax.vecmath.Point3d
get3DCenter()
Returns the geometric 3D center of the bond.IAtom
getAtom(int position)
Returns an Atom from this bond.int
getAtomCount()
Returns the number of Atoms in this Bond.IAtom
getBegin()
Access the begin (or first) atom of the bond.IChemObjectBuilder
getBuilder()
Returns aIChemObjectBuilder
for the data classes that extend this class.Integer
getElectronCount()
Returns the number of electrons in this electron container.IAtom
getEnd()
Access the end (or second) atom of the bond.boolean
getFlag(int flagType)
Returns the value of a given flag.boolean[]
getFlags()
Returns the whole set of flags.String
getID()
Returns the identifier (ID) of this object.int
getListenerCount()
Returns the number of ChemObjectListeners registered with this object.IBond.Order
getOrder()
Returns the bond order of this bond.IAtom
getOther(IAtom atom)
Returns the other atom in the bond, the atom is connected to the given atom.This method is only correct for two-centre bonds, for n-centre bonds the behaviour is undefined and the more correctIBond.getConnectedAtoms(IAtom)
should be used.Map<Object,Object>
getProperties()
Returns a Map with the IChemObject's properties.<T> T
getProperty(Object description)
Returns a property for the IChemObject.IBond.Stereo
getStereo()
Returns the stereo descriptor for this bond.boolean
isConnectedTo(IBond bond)
Checks whether a bond is connected to another one.void
notifyChanged()
This should be triggered by an method that changes the content of an object to that the registered listeners can react to it.void
notifyChanged(IChemObjectChangeEvent evt)
This should be triggered by an method that changes the content of an object to that the registered listeners can react to it.void
removeListener(IChemObjectListener col)
Use this to remove a ChemObjectListener from the ListenerList of this IChemObject.void
removeProperty(Object description)
Removes a property for a IChemObject.void
setAtom(IAtom atom, int position)
Sets an Atom in this bond.void
setAtoms(IAtom[] atoms)
Sets the array of atoms making up this bond.void
setElectronCount(Integer electronCount)
Sets the number of electrons in this electron container.void
setFlag(int flagType, boolean flagValue)
Sets the value of some flag.void
setFlags(boolean[] flagsNew)
Sets the whole set of flags.void
setID(String identifier)
Sets the identifier (ID) of this object.void
setOrder(IBond.Order order)
Sets the bond order of this bond.void
setProperty(Object description, Object property)
Sets a property for a IChemObject.void
setStereo(IBond.Stereo stereo)
Sets the stereo descriptor for this bond.-
Methods inherited from class org.openscience.cdk.Bond
equals, getConnectedAtom, getConnectedAtoms, getContainer, getDisplay, getIndex, hashCode, isAromatic, isInRing, setDisplay, setIsAromatic, setIsInRing, toString
-
Methods inherited from class org.openscience.cdk.ChemObject
clear, flags, getFlagValue, getNotification, getProperty, is, set, setNotification, setProperties, shallowCopy
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.openscience.cdk.interfaces.IBond
getConnectedAtom, getConnectedAtom, getConnectedAtoms, getContainer, getDisplay, getIndex, isAromatic, isInRing, setDisplay, setIsAromatic, setIsInRing
-
Methods inherited from interface org.openscience.cdk.interfaces.IChemObject
clear, flags, getFlagValue, getNotification, getProperty, is, set, setNotification, setProperties, toString
-
-
-
-
Constructor Detail
-
DebugBond
public DebugBond()
-
DebugBond
public DebugBond(IAtom atom1, IAtom atom2, IBond.Order order)
-
DebugBond
public DebugBond(IAtom atom1, IAtom atom2, IBond.Order order, IBond.Stereo stereo)
-
DebugBond
public DebugBond(IAtom[] atoms)
-
DebugBond
public DebugBond(IAtom[] atoms, IBond.Order order)
-
-
Method Detail
-
getElectronCount
public Integer getElectronCount()
Returns the number of electrons in this electron container.- Specified by:
getElectronCount
in interfaceIElectronContainer
- Overrides:
getElectronCount
in classElectronContainer
- Returns:
- The number of electrons in this electron container.
- See Also:
ElectronContainer.setElectronCount(java.lang.Integer)
-
setElectronCount
public void setElectronCount(Integer electronCount)
Sets the number of electrons in this electron container.- Specified by:
setElectronCount
in interfaceIElectronContainer
- Overrides:
setElectronCount
in classElectronContainer
- Parameters:
electronCount
- The number of electrons in this electron container.- See Also:
ElectronContainer.getElectronCount()
-
addListener
public void addListener(IChemObjectListener col)
Use this to add yourself to this IChemObject as a listener. In order to do so, you must implement the ChemObjectListener Interface.- Specified by:
addListener
in interfaceIChemObject
- Overrides:
addListener
in classChemObject
- Parameters:
col
- the ChemObjectListener- See Also:
ChemObject.removeListener(org.openscience.cdk.interfaces.IChemObjectListener)
-
getListenerCount
public int getListenerCount()
Returns the number of ChemObjectListeners registered with this object.- Specified by:
getListenerCount
in interfaceIChemObject
- Overrides:
getListenerCount
in classChemObject
- Returns:
- the number of registered listeners.
-
removeListener
public void removeListener(IChemObjectListener col)
Use this to remove a ChemObjectListener from the ListenerList of this IChemObject. It will then not be notified of change in this object anymore.- Specified by:
removeListener
in interfaceIChemObject
- Overrides:
removeListener
in classChemObject
- Parameters:
col
- The ChemObjectListener to be removed- See Also:
ChemObject.addListener(org.openscience.cdk.interfaces.IChemObjectListener)
-
notifyChanged
public void notifyChanged()
This should be triggered by an method that changes the content of an object to that the registered listeners can react to it.- Specified by:
notifyChanged
in interfaceIChemObject
- Overrides:
notifyChanged
in classChemObject
-
notifyChanged
public void notifyChanged(IChemObjectChangeEvent evt)
This should be triggered by an method that changes the content of an object to that the registered listeners can react to it. This is a version of notifyChanged() which allows to propagate a change event while preserving the original origin.- Specified by:
notifyChanged
in interfaceIChemObject
- Overrides:
notifyChanged
in classChemObject
- Parameters:
evt
- A ChemObjectChangeEvent pointing to the source of where the change happened
-
setProperty
public void setProperty(Object description, Object property)
Sets a property for a IChemObject.- Specified by:
setProperty
in interfaceIChemObject
- Overrides:
setProperty
in classChemObject
- Parameters:
description
- An object description of the property (most likely a unique string)property
- An object with the property itself- See Also:
ChemObject.getProperty(java.lang.Object)
,ChemObject.removeProperty(java.lang.Object)
-
removeProperty
public void removeProperty(Object description)
Removes a property for a IChemObject.- Specified by:
removeProperty
in interfaceIChemObject
- Overrides:
removeProperty
in classChemObject
- Parameters:
description
- The object description of the property (most likely a unique string)- See Also:
ChemObject.setProperty(java.lang.Object, java.lang.Object)
,ChemObject.getProperty(java.lang.Object)
-
getProperty
public <T> T getProperty(Object description)
Returns a property for the IChemObject.- Specified by:
getProperty
in interfaceIChemObject
- Overrides:
getProperty
in classChemObject
- Type Parameters:
T
- generic return type- Parameters:
description
- An object description of the property (most likely a unique string)- Returns:
- The object containing the property. Returns null if propert is not set.
- See Also:
ChemObject.setProperty(java.lang.Object, java.lang.Object)
,ChemObject.removeProperty(java.lang.Object)
-
getProperties
public Map<Object,Object> getProperties()
Returns a Map with the IChemObject's properties.- Specified by:
getProperties
in interfaceIChemObject
- Overrides:
getProperties
in classChemObject
- Returns:
- The object's properties as an Hashtable
- See Also:
ChemObject.addProperties(java.util.Map<java.lang.Object, java.lang.Object>)
-
getID
public String getID()
Returns the identifier (ID) of this object.- Specified by:
getID
in interfaceIChemObject
- Overrides:
getID
in classChemObject
- Returns:
- a String representing the ID value
- See Also:
ChemObject.setID(java.lang.String)
-
setID
public void setID(String identifier)
Sets the identifier (ID) of this object.- Specified by:
setID
in interfaceIChemObject
- Overrides:
setID
in classChemObject
- Parameters:
identifier
- a String representing the ID value- See Also:
ChemObject.getID()
-
setFlag
public void setFlag(int flagType, boolean flagValue)
Sets the value of some flag. The flag is a mask from a given CDKConstant (e.g.IChemObject.AROMATIC
orIChemObject.VISITED
). The flags are intrinsic internal properties and should not be used to store custom values, please useIChemObject.setProperty(Object, Object)
.// set this chem object to be aromatic chemObject.setFlag(CDKConstants.ISAROMATIC, Boolean.TRUE); // ... // indicate we have visited this chem object chemObject.setFlag(CDKConstants.VISITED, Boolean.TRUE);
- Specified by:
setFlag
in interfaceIChemObject
- Overrides:
setFlag
in classChemObject
- Parameters:
flagType
- flag to set the value forflagValue
- value to assign to flag- See Also:
IChemObject.getFlag(int)
-
getFlag
public boolean getFlag(int flagType)
Returns the value of a given flag. The flag is a mask from a given CDKConstant (e.g.IChemObject.AROMATIC
).if(chemObject.getFlag(CDKConstants.ISAROMATIC)){ // handle aromatic flag on this chem object }
- Specified by:
getFlag
in interfaceIChemObject
- Overrides:
getFlag
in classChemObject
- Parameters:
flagType
- flag to retrieve the value of- Returns:
- true if the flag
flag_type
is set - See Also:
IChemObject.setFlag(int, boolean)
-
addProperties
public void addProperties(Map<Object,Object> properties)
Sets the properties of this object.- Specified by:
addProperties
in interfaceIChemObject
- Overrides:
addProperties
in classChemObject
- Parameters:
properties
- a Hashtable specifying the property values- See Also:
ChemObject.getProperties()
-
setFlags
public void setFlags(boolean[] flagsNew)
Sets the whole set of flags.- Specified by:
setFlags
in interfaceIChemObject
- Overrides:
setFlags
in classChemObject
- Parameters:
flagsNew
- the new flags.- See Also:
ChemObject.getFlags()
-
getFlags
public boolean[] getFlags()
Returns the whole set of flags.- Specified by:
getFlags
in interfaceIChemObject
- Overrides:
getFlags
in classChemObject
- Returns:
- the flags.
- See Also:
ChemObject.setFlags(boolean[])
-
clone
public IBond clone() throws CloneNotSupportedException
Clones this bond object, including clones of the atoms between which the bond is defined.- Specified by:
clone
in interfaceIBond
- Specified by:
clone
in interfaceIChemObject
- Overrides:
clone
in classBond
- Returns:
- The cloned object
- Throws:
CloneNotSupportedException
- if the IChemObject cannot be cloned
-
getBuilder
public IChemObjectBuilder getBuilder()
Returns aIChemObjectBuilder
for the data classes that extend this class.- Specified by:
getBuilder
in interfaceICDKObject
- Overrides:
getBuilder
in classChemObject
- Returns:
- The
IChemObjectBuilder
matching thisICDKObject
-
atoms
public Iterable<IAtom> atoms()
Returns the Iterator to atoms making up this bond. Iterator.remove() is not implemented.- Specified by:
atoms
in interfaceIBond
- Overrides:
atoms
in classBond
- Returns:
- An Iterator to atoms participating in this bond
- See Also:
Bond.setAtoms(org.openscience.cdk.interfaces.IAtom[])
-
setAtoms
public void setAtoms(IAtom[] atoms)
Sets the array of atoms making up this bond.- Specified by:
setAtoms
in interfaceIBond
- Overrides:
setAtoms
in classBond
- Parameters:
atoms
- An array of atoms that forms this bond- See Also:
Bond.atoms
-
getAtomCount
public int getAtomCount()
Returns the number of Atoms in this Bond.- Specified by:
getAtomCount
in interfaceIBond
- Overrides:
getAtomCount
in classBond
- Returns:
- The number of Atoms in this Bond
-
getAtom
public IAtom getAtom(int position)
Returns an Atom from this bond.- Specified by:
getAtom
in interfaceIBond
- Overrides:
getAtom
in classBond
- Parameters:
position
- The position in this bond where the atom is- Returns:
- The atom at the specified position, null if there are no atoms in the bond
- See Also:
Bond.setAtom(org.openscience.cdk.interfaces.IAtom, int)
-
getBegin
public IAtom getBegin()
Access the begin (or first) atom of the bond.
-
getEnd
public IAtom getEnd()
Access the end (or second) atom of the bond.
-
getOther
public IAtom getOther(IAtom atom)
Returns the other atom in the bond, the atom is connected to the given atom.This method is only correct for two-centre bonds, for n-centre bonds the behaviour is undefined and the more correctIBond.getConnectedAtoms(IAtom)
should be used.IAtom beg = bond.getBegin(); IAtom end = bond.getEnd(); // bond.getOther(beg) == end // bond.getOther(end) == beg
-
contains
public boolean contains(IAtom atom)
Returns true if the given atom participates in this bond.
-
setAtom
public void setAtom(IAtom atom, int position)
Sets an Atom in this bond.- Specified by:
setAtom
in interfaceIBond
- Overrides:
setAtom
in classBond
- Parameters:
atom
- The atom to be setposition
- The position in this bond where the atom is to be inserted- See Also:
Bond.getAtom(int)
-
getOrder
public IBond.Order getOrder()
Returns the bond order of this bond.- Specified by:
getOrder
in interfaceIBond
- Overrides:
getOrder
in classBond
- Returns:
- The bond order of this bond
- See Also:
org.openscience.cdk.CDKConstants for predefined values.
,Bond.setOrder(org.openscience.cdk.interfaces.IBond.Order)
-
setOrder
public void setOrder(IBond.Order order)
Sets the bond order of this bond.- Specified by:
setOrder
in interfaceIBond
- Overrides:
setOrder
in classBond
- Parameters:
order
- The bond order to be assigned to this bond- See Also:
org.openscience.cdk.CDKConstants for predefined values.
,Bond.getOrder()
-
getStereo
public IBond.Stereo getStereo()
Returns the stereo descriptor for this bond.- Specified by:
getStereo
in interfaceIBond
- Overrides:
getStereo
in classBond
- Returns:
- The stereo descriptor for this bond
- See Also:
Bond.setStereo(org.openscience.cdk.interfaces.IBond.Stereo)
,for predefined values.
-
setStereo
public void setStereo(IBond.Stereo stereo)
Sets the stereo descriptor for this bond.- Specified by:
setStereo
in interfaceIBond
- Overrides:
setStereo
in classBond
- Parameters:
stereo
- The stereo descriptor to be assigned to this bond.- See Also:
Bond.getStereo()
,for predefined values.
-
get2DCenter
public javax.vecmath.Point2d get2DCenter()
Returns the geometric 2D center of the bond.- Specified by:
get2DCenter
in interfaceIBond
- Overrides:
get2DCenter
in classBond
- Returns:
- The geometric 2D center of the bond
-
get3DCenter
public javax.vecmath.Point3d get3DCenter()
Returns the geometric 3D center of the bond.- Specified by:
get3DCenter
in interfaceIBond
- Overrides:
get3DCenter
in classBond
- Returns:
- The geometric 3D center of the bond
-
compare
public boolean compare(Object object)
Compares a bond with this bond.
-
isConnectedTo
public boolean isConnectedTo(IBond bond)
Checks whether a bond is connected to another one. This can only be true if the bonds have an Atom in common.- Specified by:
isConnectedTo
in interfaceIBond
- Overrides:
isConnectedTo
in classBond
- Parameters:
bond
- The bond which is checked to be connect with this one- Returns:
- true if the bonds share an atom, otherwise false
-
-