Package org.openscience.cdk
Class ChemObject
java.lang.Object
org.openscience.cdk.ChemObject
- All Implemented Interfaces:
Serializable,Cloneable,ICDKObject,IChemObject
- Direct Known Subclasses:
AtomContainer,AtomContainerLegacy,AtomContainerSet,ChemFile,ChemModel,ChemSequence,ElectronContainer,Element,Mapping,PDBStructure,Reaction,ReactionSet
The base class for all chemical objects in this cdk. It provides methods for
adding listeners and for their notification of events, as well a a hash
table for administration of physical or chemical properties
- Author:
- steinbeck
- See Also:
-
Field Summary
Fields inherited from interface org.openscience.cdk.interfaces.IChemObject
ALIPHATIC, AROMATIC, CONJUGATED, HYDROGEN_BOND_ACCEPTOR, HYDROGEN_BOND_DONOR, IN_RING, MAPPED, MARKUSH, NOT_IN_RING, PLACED, REACTIVE_CENTER, SINGLE_OR_DOUBLE, TYPEABLE, VISITED -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new IChemObject.ChemObject(IChemObject chemObject) Constructs a new IChemObject by copying the flags, and the identifier. -
Method Summary
Modifier and TypeMethodDescriptionvoidUse this to add yourself to this IChemObject as a listener.voidaddProperties(Map<Object, Object> properties) Sets the properties of this object.voidclear(int flags) clone()Clones thisIChemObject.booleanCompares a IChemObject with this IChemObject.intflags()booleangetFlag(int mask) boolean[]getFlags()Returns the whole set of flags.getID()Returns the identifier (ID) of this object.intReturns the number of ChemObjectListeners registered with this object.booleanReturns a Map with the IChemObject's properties.<T> TgetProperty(Object description) Returns a property for the IChemObject.<T> TgetProperty(Object description, Class<T> c) booleanis(int flags) voidThis should be triggered by an method that changes the content of an object to that the registered listeners can react to it.voidThis should be triggered by an method that changes the content of an object to that the registered listeners can react to it.voidUse this to remove a ChemObjectListener from the ListenerList of this IChemObject.voidremoveProperty(Object description) Removes a property for a IChemObject.voidset(int flags) voidsetFlag(int mask, boolean value) voidsetFlags(boolean[] flagsNew) Sets the whole set of flags.voidSets the identifier (ID) of this object.voidsetNotification(boolean bool) voidsetProperties(Map<Object, Object> properties) voidsetProperty(Object description, Object property) Sets a property for a IChemObject.Clones thisIChemObject, but preserves references toObjects.Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openscience.cdk.interfaces.IChemObject
toString
-
Constructor Details
-
ChemObject
public ChemObject()Constructs a new IChemObject. -
ChemObject
Constructs a new IChemObject by copying the flags, and the identifier. It does not copy the listeners and properties.- Parameters:
chemObject- the object to copy
-
-
Method Details
-
addListener
Use this to add yourself to this IChemObject as a listener. In order to do so, you must implement the ChemObjectListener Interface.- Specified by:
addListenerin interfaceIChemObject- Parameters:
col- the ChemObjectListener- See Also:
-
getListenerCount
public int getListenerCount()Returns the number of ChemObjectListeners registered with this object.- Specified by:
getListenerCountin interfaceIChemObject- Returns:
- the number of registered listeners.
-
removeListener
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:
removeListenerin interfaceIChemObject- Parameters:
col- The ChemObjectListener to be removed- See Also:
-
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:
notifyChangedin interfaceIChemObject
-
notifyChanged
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:
notifyChangedin interfaceIChemObject- Parameters:
evt- A ChemObjectChangeEvent pointing to the source of where the change happened
-
setProperty
Sets a property for a IChemObject.- Specified by:
setPropertyin interfaceIChemObject- Parameters:
description- An object description of the property (most likely a unique string)property- An object with the property itself- See Also:
-
removeProperty
Removes a property for a IChemObject.- Specified by:
removePropertyin interfaceIChemObject- Parameters:
description- The object description of the property (most likely a unique string)- See Also:
-
getProperty
Returns a property for the IChemObject.- Specified by:
getPropertyin interfaceIChemObject- 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:
-
getProperty
- Specified by:
getPropertyin interfaceIChemObject
-
getProperties
Returns a Map with the IChemObject's properties.- Specified by:
getPropertiesin interfaceIChemObject- Returns:
- The object's properties as an Hashtable
- See Also:
-
clone
Clones thisIChemObject. It clones the identifier, flags, properties and pointer vectors. The ChemObjectListeners are not cloned, and neither is the content of the pointer vectors.- Specified by:
clonein interfaceIChemObject- Overrides:
clonein classObject- Returns:
- The cloned object
- Throws:
CloneNotSupportedException
-
compare
Compares a IChemObject with this IChemObject.- Parameters:
object- Object of type AtomType- Returns:
- true if the atom types are equal
-
getID
Returns the identifier (ID) of this object.- Specified by:
getIDin interfaceIChemObject- Returns:
- a String representing the ID value
- See Also:
-
setID
Sets the identifier (ID) of this object.- Specified by:
setIDin interfaceIChemObject- Parameters:
identifier- a String representing the ID value- See Also:
-
setFlag
public void setFlag(int mask, boolean value) - Specified by:
setFlagin interfaceIChemObject
-
getFlag
public boolean getFlag(int mask) - Specified by:
getFlagin interfaceIChemObject
-
getFlagValue
- Specified by:
getFlagValuein interfaceIChemObject
-
set
public void set(int flags) - Specified by:
setin interfaceIChemObject
-
is
public boolean is(int flags) - Specified by:
isin interfaceIChemObject
-
clear
public void clear(int flags) - Specified by:
clearin interfaceIChemObject
-
flags
public int flags()- Specified by:
flagsin interfaceIChemObject
-
setProperties
- Specified by:
setPropertiesin interfaceIChemObject
-
addProperties
Sets the properties of this object.- Specified by:
addPropertiesin interfaceIChemObject- Parameters:
properties- a Hashtable specifying the property values- See Also:
-
setFlags
public void setFlags(boolean[] flagsNew) Sets the whole set of flags.- Specified by:
setFlagsin interfaceIChemObject- Parameters:
flagsNew- the new flags.- See Also:
-
getFlags
public boolean[] getFlags()Returns the whole set of flags.- Specified by:
getFlagsin interfaceIChemObject- Returns:
- the flags.
- See Also:
-
shallowCopy
Clones thisIChemObject, but preserves references toObjects.- Returns:
- Shallow copy of this IChemObject
- See Also:
-
getBuilder
- Specified by:
getBuilderin interfaceICDKObject
-
setNotification
public void setNotification(boolean bool) - Specified by:
setNotificationin interfaceIChemObject
-
getNotification
public boolean getNotification()- Specified by:
getNotificationin interfaceIChemObject
-