public class AtomRef extends Object implements IAtom
IAtom
indirectly. All
methods are passed through to the referenced atom. The reference can
be used to override the behaviour of the base atom.IAtomType.Hybridization
Ac, Ag, Al, Am, Ar, As, At, Au, B, Ba, Be, Bh, Bi, Bk, Br, C, Ca, Cd, Ce, Cf, Cl, Cm, Cn, Co, Cr, Cs, Cu, Db, Ds, Dy, Er, Es, Eu, F, Fe, Fl, Fm, Fr, Ga, Gd, Ge, H, He, Hf, Hg, Ho, Hs, I, In, Ir, K, Kr, La, Li, Lr, Lu, Lv, Mc, Md, Mg, Mn, Mo, Mt, N, Na, Nb, Nd, Ne, Nh, Ni, No, Np, O, Og, Os, P, Pa, Pb, Pd, Pm, Po, Pr, Pt, Pu, Ra, Rb, Re, Rf, Rg, Rh, Rn, Ru, S, Sb, Sc, Se, Sg, Si, Sm, Sn, Sr, Ta, Tb, Tc, Te, Th, Ti, Tl, Tm, Ts, U, V, W, Wildcard, Xe, Y, Yb, Zn, Zr
Constructor and Description |
---|
AtomRef(IAtom atom)
Create a pointer for the provided atom.
|
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.
|
Iterable<IBond> |
bonds()
Returns the bonds connected to this atom.
|
IAtom |
clone()
Returns a deep clone of this IChemObject.
|
IAtom |
deref()
Dereference the atom pointer once providing access to the base
atom.
|
static IAtom |
deref(IAtom atom)
Utility method to dereference an atom.
|
boolean |
equals(Object obj) |
Integer |
getAtomicNumber()
Returns the atomic number of this element.
|
String |
getAtomTypeName()
Gets the id attribute of the AtomType object.
|
IBond |
getBond(IAtom atom)
Returns the bond connecting 'this' atom to the provided atom.
|
int |
getBondCount()
Get the number of explicit bonds connected to this atom.
|
Double |
getBondOrderSum()
Gets the bondOrderSum attribute of the AtomType object.
|
IChemObjectBuilder |
getBuilder()
Returns a
IChemObjectBuilder for the data classes that extend
this class. |
Double |
getCharge()
Returns the partial charge of this atom.
|
IAtomContainer |
getContainer()
Access the
IAtomContainer of which this atom is a member of. |
Double |
getCovalentRadius()
Returns the covalent radius for this AtomType.
|
Double |
getExactMass()
Gets the ExactMass attribute of the Isotope object.
|
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.
|
Integer |
getFormalCharge()
Returns the formal charge of this atom.
|
Integer |
getFormalNeighbourCount()
Returns the formal neighbour count of this atom.
|
javax.vecmath.Point3d |
getFractionalPoint3d()
Returns a point specifying the location of this
atom in a Crystal unit cell.
|
IAtomType.Hybridization |
getHybridization()
Returns the hybridization of this atom.
|
String |
getID()
Returns the identifier (ID) of this object.
|
Integer |
getImplicitHydrogenCount()
Returns the implicit hydrogen count of this atom.
|
int |
getIndex()
Acces the index of an atom in the context of an
IAtomContainer . |
int |
getListenerCount()
Returns the number of ChemObjectListeners registered with this object.
|
int |
getMapIdx()
Access the map index for this atom.
|
Integer |
getMassNumber()
Returns the atomic mass of this element.
|
IBond.Order |
getMaxBondOrder()
Gets the MaxBondOrder attribute of the AtomType object.
|
Double |
getNaturalAbundance()
Gets the NaturalAbundance attribute of the Isotope object.
|
boolean |
getNotification()
Returns the flag that indicates whether notification messages are sent around.
|
javax.vecmath.Point2d |
getPoint2d()
Returns a point specifying the location of this
atom in a 2D space.
|
javax.vecmath.Point3d |
getPoint3d()
Returns a point specifying the location of this
atom in a 3D space.
|
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.
|
Integer |
getStereoParity()
Returns the stereo parity of this atom.
|
String |
getSymbol()
Returns the element symbol of this element.
|
Integer |
getValency()
Gets the the exact electron valency of the AtomType object.
|
int |
hashCode() |
boolean |
isAromatic()
Access whether this atom has been marked as aromatic.
|
boolean |
isInRing()
Access whether this atom has been flagged as in a ring.
|
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 |
setAtomicNumber(Integer atomicNumber)
Sets the atomic number of this element.
|
void |
setAtomTypeName(String identifier)
Sets the if attribute of the AtomType object.
|
void |
setBondOrderSum(Double bondOrderSum)
Sets the the exact bond order sum attribute of the AtomType object.
|
void |
setCharge(Double charge)
Sets the partial charge of this atom.
|
void |
setCovalentRadius(Double radius)
Sets the covalent radius for this AtomType.
|
void |
setExactMass(Double exactMass)
Sets the ExactMass attribute of the Isotope object.
|
void |
setFlag(int mask,
boolean value)
Sets the value of some flag.
|
void |
setFlags(boolean[] newFlags)
Sets the whole set of flags.
|
void |
setFormalCharge(Integer charge)
Sets the formal charge of this atom.
|
void |
setFormalNeighbourCount(Integer count)
Sets the formal neighbour count of this atom.
|
void |
setFractionalPoint3d(javax.vecmath.Point3d point3d)
Sets a point specifying the location of this
atom in a Crystal unit cell.
|
void |
setHybridization(IAtomType.Hybridization hybridization)
Sets the hybridization of this atom.
|
void |
setID(String identifier)
Sets the identifier (ID) of this object.
|
void |
setImplicitHydrogenCount(Integer hydrogenCount)
Sets the implicit hydrogen count of this atom.
|
void |
setIsAromatic(boolean arom)
Mark this atom as being aromatic.
|
void |
setIsInRing(boolean ring)
Mark this atom as being in a ring.
|
void |
setMapIdx(int mapidx)
Set the map index for this atom.
|
void |
setMassNumber(Integer massNumber)
Sets the atomic mass of this element.
|
void |
setMaxBondOrder(IBond.Order maxBondOrder)
Sets the MaxBondOrder attribute of the AtomType object.
|
void |
setNaturalAbundance(Double naturalAbundance)
Sets the NaturalAbundance attribute of the Isotope object.
|
void |
setNotification(boolean bool)
Set a flag to use or not use notification.
|
void |
setPoint2d(javax.vecmath.Point2d point2d)
Sets a point specifying the location of this
atom in a 2D space.
|
void |
setPoint3d(javax.vecmath.Point3d point3d)
Sets a point specifying the location of this
atom in 3D space.
|
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.
|
void |
setStereoParity(Integer stereoParity)
Sets the stereo parity for this atom.
|
void |
setSymbol(String symbol)
Sets the element symbol of this element.
|
void |
setValency(Integer valency)
Sets the the exact electron valency of the AtomType object.
|
String |
toString()
Returns a one line description of this IChemObject.
|
finalize, getClass, notify, notifyAll, wait, wait, wait
addListener, addProperties, getFlag, getFlags, getFlagValue, getID, getListenerCount, getNotification, getProperties, getProperty, getProperty, notifyChanged, notifyChanged, removeListener, removeProperty, setFlag, setFlags, setID, setNotification, setProperties, setProperty
getBuilder
public AtomRef(IAtom atom)
atom
- the atom to referencepublic static IAtom deref(IAtom atom)
AtomRef
it simply returns the input.atom
- the atompublic IAtom deref()
public Double getCharge()
getCharge
in interface IAtom
IAtom.setCharge(java.lang.Double)
public void setCharge(Double charge)
setCharge
in interface IAtom
charge
- The partial chargeIAtom.getCharge()
public Integer getAtomicNumber()
Once instantiated all field not filled by passing parameters to the constructor are null. Elements can be configured by using the IsotopeFactory.configure() method:
Element element = new Element("C"); IsotopeFactory if = IsotopeFactory.getInstance(element.getNewBuilder()); if.configure(element);
getAtomicNumber
in interface IElement
IElement.setAtomicNumber(java.lang.Integer)
public void setAtomicNumber(Integer atomicNumber)
setAtomicNumber
in interface IElement
atomicNumber
- The atomic mass to be assigned to this elementIElement.getAtomicNumber()
public Double getNaturalAbundance()
getNaturalAbundance
in interface IIsotope
IIsotope.setNaturalAbundance(java.lang.Double)
public void setNaturalAbundance(Double naturalAbundance)
setNaturalAbundance
in interface IIsotope
naturalAbundance
- The new NaturalAbundance valueIIsotope.getNaturalAbundance()
public Integer getImplicitHydrogenCount()
getImplicitHydrogenCount
in interface IAtom
IAtom.setImplicitHydrogenCount(java.lang.Integer)
public void setImplicitHydrogenCount(Integer hydrogenCount)
setImplicitHydrogenCount
in interface IAtom
hydrogenCount
- The number of hydrogen atoms bonded to this atom.IAtom.getImplicitHydrogenCount()
public Double getExactMass()
getExactMass
in interface IIsotope
IIsotope.setExactMass(java.lang.Double)
public void setExactMass(Double exactMass)
setExactMass
in interface IIsotope
exactMass
- The new ExactMass valueIIsotope.getExactMass()
public String getSymbol()
getSymbol
in interface IElement
IElement.setSymbol(java.lang.String)
public void setSymbol(String symbol)
setSymbol
in interface IElement
symbol
- The element symbol to be assigned to this atomIElement.getSymbol()
public Integer getMassNumber()
getMassNumber
in interface IIsotope
IIsotope.setMassNumber(Integer)
public void setMassNumber(Integer massNumber)
setMassNumber
in interface IIsotope
massNumber
- The atomic mass to be assigned to this elementIIsotope.getMassNumber()
public String getAtomTypeName()
getAtomTypeName
in interface IAtomType
IAtomType.setAtomTypeName(java.lang.String)
public void setAtomTypeName(String identifier)
setAtomTypeName
in interface IAtomType
identifier
- The new AtomTypeID value. Null if unset.IAtomType.getAtomTypeName()
public IBond.Order getMaxBondOrder()
getMaxBondOrder
in interface IAtomType
IAtomType.setMaxBondOrder(org.openscience.cdk.interfaces.IBond.Order)
public void setMaxBondOrder(IBond.Order maxBondOrder)
setMaxBondOrder
in interface IAtomType
maxBondOrder
- The new MaxBondOrder valueIAtomType.getMaxBondOrder()
public Double getBondOrderSum()
getBondOrderSum
in interface IAtomType
IAtomType.setBondOrderSum(java.lang.Double)
public void setBondOrderSum(Double bondOrderSum)
setBondOrderSum
in interface IAtomType
bondOrderSum
- The new bondOrderSum valueIAtomType.getBondOrderSum()
public javax.vecmath.Point2d getPoint2d()
getPoint2d
in interface IAtom
IAtom.setPoint2d(javax.vecmath.Point2d)
public void setPoint2d(javax.vecmath.Point2d point2d)
setPoint2d
in interface IAtom
point2d
- A point in a 2D planeIAtom.getPoint2d()
public javax.vecmath.Point3d getPoint3d()
getPoint3d
in interface IAtom
IAtom.setPoint3d(javax.vecmath.Point3d)
public void setPoint3d(javax.vecmath.Point3d point3d)
setPoint3d
in interface IAtom
point3d
- A point in a 3-dimensional spaceIAtom.getPoint3d()
public Integer getFormalCharge()
getFormalCharge
in interface IAtomType
IAtomType.setFormalCharge(java.lang.Integer)
public void setFormalCharge(Integer charge)
setFormalCharge
in interface IAtomType
charge
- The formal chargeIAtomType.getFormalCharge()
public javax.vecmath.Point3d getFractionalPoint3d()
getFractionalPoint3d
in interface IAtom
IAtom.setFractionalPoint3d(javax.vecmath.Point3d)
,
for predefined values.
public void setFractionalPoint3d(javax.vecmath.Point3d point3d)
setFractionalPoint3d
in interface IAtom
point3d
- A point in a 3d fractional unit cell spaceIAtom.getFractionalPoint3d()
,
Crystal
public Integer getFormalNeighbourCount()
getFormalNeighbourCount
in interface IAtomType
IAtomType.setFormalNeighbourCount(java.lang.Integer)
public void setFormalNeighbourCount(Integer count)
setFormalNeighbourCount
in interface IAtomType
count
- The neighbour countIAtomType.getFormalNeighbourCount()
public Integer getStereoParity()
getStereoParity
in interface IAtom
CDKConstants
,
IAtom.setStereoParity(java.lang.Integer)
public void setStereoParity(Integer stereoParity)
setStereoParity
in interface IAtom
stereoParity
- The stereo parity for this atomfor predefined values.
,
IAtom.getStereoParity()
public IAtomType.Hybridization getHybridization()
getHybridization
in interface IAtomType
IAtomType.setHybridization(org.openscience.cdk.interfaces.IAtomType.Hybridization)
public void setHybridization(IAtomType.Hybridization hybridization)
setHybridization
in interface IAtomType
hybridization
- The hybridizationIAtomType.getHybridization()
public Double getCovalentRadius()
getCovalentRadius
in interface IAtomType
IAtomType.setCovalentRadius(java.lang.Double)
public void setCovalentRadius(Double radius)
setCovalentRadius
in interface IAtomType
radius
- The covalent radius for this AtomTypeIAtomType.getCovalentRadius()
public IAtomContainer getContainer()
IAtomContainer
of which this atom is a member of. Because atoms
can be in multiple molecules this method will only work if the atom has been accessed
in the context of an IAtomContainer
, for example:
IAtomContainer mol = new AtomContainer();
IAtom atom = new Atom(6);
atom.getContainer(); // null
mol.add(atom);
atom.getContainer(); // still null
mol.getAtom(0).getContainer(); // not-null, returns 'mol'
getContainer
in interface IAtom
public int getIndex()
IAtomContainer
. If the
index is not known, < 0 is returned.public Integer getValency()
getValency
in interface IAtomType
IAtomType.setValency(Integer)
public void setValency(Integer valency)
setValency
in interface IAtomType
valency
- The new valency valueIAtomType.getValency()
public Iterable<IBond> bonds()
IAtom
IAtom.getIndex()
returns < 0 or IAtom.getContainer()
returns null.
IAtom atom = ...;
if (atom.getIndex() >= 0) {
for (IBond bond : atom.bonds()) {
}
}
if (atom.getContainer() != null) {
for (IBond bond : atom.bonds()) {
}
}
IAtomContainer mol = ...;
// guaranteed not throw an exception
for (IBond bond : mol.getAtom(i).bonds()) {
}
public int getBondCount()
IAtom
getBondCount
in interface IAtom
public IBond getBond(IAtom atom)
public boolean isAromatic()
isAromatic
in interface IAtom
IChemObject.getFlag(int)
,
Aromaticity
public void setIsAromatic(boolean arom)
setIsAromatic
in interface IAtom
arom
- aromatic statusIChemObject.setFlag(int, boolean)
public boolean isInRing()
isInRing
in interface IAtom
IChemObject.getFlag(int)
,
RingSearch
public void setIsInRing(boolean ring)
setIsInRing
in interface IAtom
ring
- ring statusIChemObject.setFlag(int, boolean)
public int getMapIdx()
IAtom
public void setMapIdx(int mapidx)
IAtom
public IAtom clone() throws CloneNotSupportedException
clone
in interface IAtom
clone
in interface IChemObject
CloneNotSupportedException
- if the IChemObject cannot be clonedpublic String toString()
IChemObject
toString
in interface IChemObject
toString
in class Object
public IChemObjectBuilder getBuilder()
IChemObjectBuilder
for the data classes that extend
this class.getBuilder
in interface ICDKObject
IChemObjectBuilder
matching this ICDKObject
public void addListener(IChemObjectListener col)
addListener
in interface IChemObject
col
- the ChemObjectListenerIChemObject.removeListener(org.openscience.cdk.interfaces.IChemObjectListener)
public int getListenerCount()
getListenerCount
in interface IChemObject
public void removeListener(IChemObjectListener col)
removeListener
in interface IChemObject
col
- The ChemObjectListener to be removedIChemObject.addListener(org.openscience.cdk.interfaces.IChemObjectListener)
public void setNotification(boolean bool)
setNotification
in interface IChemObject
bool
- if true, then notification messages are sent.IChemObject.getNotification()
public boolean getNotification()
getNotification
in interface IChemObject
IChemObject.setNotification(boolean)
public void notifyChanged()
notifyChanged
in interface IChemObject
public void notifyChanged(IChemObjectChangeEvent evt)
notifyChanged
in interface IChemObject
evt
- A ChemObjectChangeEvent pointing to the source of where
the change happendpublic void setProperty(Object description, Object property)
setProperty
in interface IChemObject
description
- An object description of the property (most likely a
unique string)property
- An object with the property itselfIChemObject.getProperty(java.lang.Object)
,
IChemObject.removeProperty(java.lang.Object)
public void removeProperty(Object description)
removeProperty
in interface IChemObject
description
- The object description of the property (most likely a
unique string)IChemObject.setProperty(java.lang.Object, java.lang.Object)
,
IChemObject.getProperty(java.lang.Object)
public <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
getProperty
in interface IChemObject
T
- generic return typedescription
- An object description of the property (most likely a
unique string)IChemObject.setProperty(java.lang.Object, java.lang.Object)
,
IChemObject.getProperty(Object, Class)
,
IChemObject.removeProperty(java.lang.Object)
public <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
getProperty
in interface IChemObject
T
- generic type (of provided class)description
- description of a property (normally a string)c
- type of the value to be returnedIChemObject.getProperty(Object)
,
IChemObject.addProperties(java.util.Map)
public Map<Object,Object> getProperties()
getProperties
in interface IChemObject
IChemObject.addProperties(java.util.Map<java.lang.Object, java.lang.Object>)
public String getID()
getID
in interface IChemObject
IChemObject.setID(java.lang.String)
public void setID(String identifier)
setID
in interface IChemObject
identifier
- a String representing the ID valueIChemObject.getID()
public void setFlag(int mask, boolean value)
CDKConstants.ISAROMATIC
or CDKConstants.VISITED
). The flags are
intrinsic internal properties and should not be used to store custom
values, please use IChemObject.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);
setFlag
in interface IChemObject
mask
- flag to set the value forvalue
- value to assign to flagIChemObject.getFlag(int)
,
CDKConstants
public boolean getFlag(int mask)
CDKConstants.ISAROMATIC
).
if(chemObject.getFlag(CDKConstants.ISAROMATIC)){
// handle aromatic flag on this chem object
}
getFlag
in interface IChemObject
mask
- flag to retrieve the value offlag_type
is setIChemObject.setFlag(int, boolean)
,
CDKConstants
public void setProperties(Map<Object,Object> properties)
setProperties
in interface IChemObject
properties
- map key-value pairspublic void addProperties(Map<Object,Object> properties)
addProperties
in interface IChemObject
properties
- a Map specifying the property valuesIChemObject.getProperties()
public void setFlags(boolean[] newFlags)
IChemObject.setFlag(int, boolean)
for each value in the array and
use CDKConstants.FLAG_MASKS
to look
up the correct mask. If only a single flag is being set it is a lot
faster to use IChemObject.setFlag(int, boolean)
.setFlags
in interface IChemObject
newFlags
- the new flags to set.IChemObject.setFlag(int, boolean)
,
IChemObject.getFlags()
public boolean[] getFlags()
IChemObject.getFlagValue()
if you need all the flags. For individual flags please use IChemObject.getFlag(int)
getFlags
in interface IChemObject
IChemObject.setFlags(boolean[])
,
IChemObject.getFlag(int)
,
IChemObject.getFlagValue()
public Number getFlagValue()
getFlagValue
in interface IChemObject
Copyright © 2021. All rights reserved.