public interface IChemObject extends ICDKObject
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(IChemObjectListener col)
Use this to add yourself to this IChemObject as a listener.
|
void |
addProperties(Map<Object,Object> properties)
Add properties to this object, duplicate keys will replace any existing
value.
|
Object |
clone()
Returns a deep clone of this IChemObject.
|
boolean |
getFlag(int mask)
Returns the value of a given flag.
|
boolean[] |
getFlags()
Returns the whole set of flags.
|
Number |
getFlagValue()
Access the internal value used to store the flags.
|
String |
getID()
Returns the identifier (ID) of this object.
|
int |
getListenerCount()
Returns the number of ChemObjectListeners registered with this object.
|
boolean |
getNotification()
Returns the flag that indicates whether notification messages are sent around.
|
Map<Object,Object> |
getProperties()
Returns a Map with the IChemObject's properties.
|
<T> T |
getProperty(Object description)
Returns a property for the IChemObject - the object is automatically
cast to the required type.
|
<T> T |
getProperty(Object description,
Class<T> c)
Access a property of the given description and cast the specified class.
|
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 |
setFlag(int mask,
boolean value)
Sets the value of some flag.
|
void |
setFlags(boolean[] newFlags)
Sets the whole set of flags.
|
void |
setID(String identifier)
Sets the identifier (ID) of this object.
|
void |
setNotification(boolean bool)
Set a flag to use or not use notification.
|
void |
setProperties(Map<Object,Object> properties)
Set the properties of this object to the provided map (shallow copy).
|
void |
setProperty(Object description,
Object property)
Sets a property for a IChemObject.
|
String |
toString()
Returns a one line description of this IChemObject.
|
getBuildervoid addListener(IChemObjectListener col)
col - the ChemObjectListenerremoveListener(org.openscience.cdk.interfaces.IChemObjectListener)int getListenerCount()
void removeListener(IChemObjectListener col)
col - The ChemObjectListener to be removedaddListener(org.openscience.cdk.interfaces.IChemObjectListener)void setNotification(boolean bool)
bool - if true, then notification messages are sent.getNotification()boolean getNotification()
setNotification(boolean)void notifyChanged()
void notifyChanged(IChemObjectChangeEvent evt)
evt - A ChemObjectChangeEvent pointing to the source of where
the change happendvoid setProperty(Object description, Object property)
description - An object description of the property (most likely a
unique string)property - An object with the property itselfgetProperty(java.lang.Object),
removeProperty(java.lang.Object)void removeProperty(Object description)
description - The object description of the property (most likely a
unique string)setProperty(java.lang.Object, java.lang.Object),
getProperty(java.lang.Object)<T> T getProperty(Object description)
IAtom atom = new Atom("C");
atom.setProperty("number", 1); // set an integer property
// access the property and automatically cast to an int
Integer number = atom.getProperty("number");
// if the method is in a chain or needs to be nested the type
// can be provided
methodAcceptingInt(atom.getProperty("number", Integer.class));
// the type cannot be checked and so...
String number = atom.getProperty("number"); // ClassCastException
// if the type is provided a more meaningful error is thrown
atom.getProperty("number", String.class); // IllegalArgumentException
T - generic return typedescription - An object description of the property (most likely a
unique string)setProperty(java.lang.Object, java.lang.Object),
getProperty(Object, Class),
removeProperty(java.lang.Object)<T> T getProperty(Object description, Class<T> c)
IAtom atom = new Atom("C");
atom.setProperty("number", 1); // set an integer property
// access the property and automatically cast to an int
Integer number = atom.getProperty("number");
// if the method is in a chain or needs to be nested the type
// can be provided
methodAcceptingInt(atom.getProperty("number", Integer.class));
// the type cannot be checked and so...
String number = atom.getProperty("number"); // ClassCastException
// if the type is provided a more meaningful error is thrown
atom.getProperty("number", String.class); // IllegalArgumentException
T - generic type (of provided class)description - description of a property (normally a string)c - type of the value to be returnedgetProperty(Object),
addProperties(java.util.Map)Map<Object,Object> getProperties()
addProperties(java.util.Map<java.lang.Object, java.lang.Object>)String getID()
setID(java.lang.String)void setID(String identifier)
identifier - a String representing the ID valuegetID()void setFlag(int mask,
boolean value)
org.openscience.cdk.CDKConstants#ISAROMATIC
or org.openscience.cdk.CDKConstants#VISITED). The flags are
intrinsic internal properties and should not be used to store custom
values, please use 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);
mask - flag to set the value forvalue - value to assign to flaggetFlag(int),
org.openscience.cdk.CDKConstantsboolean getFlag(int mask)
org.openscience.cdk.CDKConstants#ISAROMATIC).
if(chemObject.getFlag(CDKConstants.ISAROMATIC)){
// handle aromatic flag on this chem object
}
mask - flag to retrieve the value offlag_type is setsetFlag(int, boolean),
org.openscience.cdk.CDKConstantsvoid setProperties(Map<Object,Object> properties)
properties - map key-value pairsvoid addProperties(Map<Object,Object> properties)
properties - a Map specifying the property valuesgetProperties()void setFlags(boolean[] newFlags)
setFlag(int, boolean) for each value in the array and
use org.openscience.cdk.CDKConstants#FLAG_MASKS to look
up the correct mask. If only a single flag is being set it is a lot
faster to use setFlag(int, boolean).newFlags - the new flags to set.setFlag(int, boolean),
getFlags()boolean[] getFlags()
getFlagValue()
if you need all the flags. For individual flags please use getFlag(int)setFlags(boolean[]),
getFlag(int),
getFlagValue()Number getFlagValue()
String toString()
Object clone() throws CloneNotSupportedException
CloneNotSupportedException - if the IChemObject cannot be clonedCopyright © 2017. All rights reserved.