public interface IMolecularFormula extends ICDKObject
Examples:
[C5H5]-
C6H6
Modifier and Type | Method and Description |
---|---|
IMolecularFormula |
add(IMolecularFormula formula)
Adds an molecularFormula to this MolecularFormula.
|
IMolecularFormula |
addIsotope(IIsotope isotope)
Adds an Isotope to this MolecularFormula one time.
|
IMolecularFormula |
addIsotope(IIsotope isotope,
int count)
Adds an Isotope to this MolecularFormula in a number of occurrences.
|
Object |
clone()
Clones this MolecularFormula object and its content.
|
boolean |
contains(IIsotope isotope)
True, if the MolecularFormula contains the given IIsotope object.
|
Integer |
getCharge()
Access the charge of this IMolecularFormula.
|
int |
getIsotopeCount()
Checks a set of Nodes for the number of different isotopes in the
IMolecularFormula.
|
int |
getIsotopeCount(IIsotope isotope)
Checks a set of Nodes for the occurrence of the isotope in the
IMolecularFormula from a particular isotope.
|
Map<Object,Object> |
getProperties()
Returns a Map with the IChemObject's properties.I should
integrate into ChemObject.
|
<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.
|
Iterable<IIsotope> |
isotopes()
Returns an
Iterable for looping over all isotopes in this IMolecularFormula. |
void |
removeAllIsotopes()
Removes all isotopes of this molecular formula.
|
void |
removeIsotope(IIsotope isotope)
Removes the given isotope from the MolecularFormula.
|
void |
removeProperty(Object description)
Removes a property for a IChemObject.
|
void |
setCharge(Integer charge)
Sets the charge of this IMolecularFormula, since there is no atom
associated with the charge the number of a given isotope is not modified.
|
void |
setProperties(Map<Object,Object> properties)
Sets the properties of this object.I should
integrate into ChemObject.
|
void |
setProperty(Object description,
Object property)
Sets a property for a IChemObject.
|
getBuilder
IMolecularFormula add(IMolecularFormula formula)
formula
- The molecularFormula to be added to this chemObjectIMolecularFormula addIsotope(IIsotope isotope)
isotope
- The isotope to be added to this MolecularFormulaaddIsotope(IIsotope, int)
IMolecularFormula addIsotope(IIsotope isotope, int count)
isotope
- The isotope to be added to this MolecularFormulacount
- The number of occurrences to addaddIsotope(IIsotope)
int getIsotopeCount(IIsotope isotope)
isotope
- The IIsotope to look forgetIsotopeCount()
Iterable<IIsotope> isotopes()
Iterable
for looping over all isotopes in this IMolecularFormula.Iterable
with the isotopes in this IMolecularFormulaint getIsotopeCount()
getIsotopeCount(IIsotope)
boolean contains(IIsotope isotope)
isotope
- The IIsotope this IMolecularFormula is searched forvoid removeIsotope(IIsotope isotope)
isotope
- The IIsotope to be removedvoid removeAllIsotopes()
void setCharge(Integer charge)
// Correct usage IMolecularFormula phenolate = MolecularFormulaManipulator.getMolecularFormula("C6H5O", builder) mf.setCharge(-1); // MF=C6H5O- // Wrong! the H6 is not automatically adjust IMolecularFormula phenolate = MolecularFormulaManipulator.getMolecularFormula("C6H6O", builder) mf.setCharge(-1); // MF=C6H6O- (wrong)If you wish to adjust the protonation of a formula try the convenience method of the
MolecularFormulaManipulator
:
IMolecularFormula mf = MolecularFormulaManipulator.getMolecularFormula("[C6H5O]-", bldr); MolecularFormulaManipulator.adjustProtonation(mf, +1); MolecularFormulaManipulator.getString(mf); // "C6H6O"
charge
- The partial chargegetCharge()
Integer getCharge()
setCharge(java.lang.Integer)
Object clone() throws CloneNotSupportedException
CloneNotSupportedException
void 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)
,
getProperties()
Map<Object,Object> getProperties()
setProperties(java.util.Map<java.lang.Object, java.lang.Object>)
void setProperties(Map<Object,Object> properties)
properties
- a Hashtable specifying the property valuesgetProperties()
Copyright © 2018. All Rights Reserved.