Package org.openscience.cdk.sgroup
Class Sgroup
- java.lang.Object
-
- org.openscience.cdk.sgroup.Sgroup
-
public class Sgroup extends Object
Generic CTab Sgroup (substructure group) that stores all other types of group. This representation is allows reading from CTfiles (e.g. Molfile, SDfile). The class uses a key-value store for Sgroup attributes simplifying both input and output.
-
-
Constructor Summary
Constructors Constructor Description Sgroup()
Create a new generic Sgroup.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAtom(IAtom atom)
Add an atom to this Sgroup.void
addBond(IBond bond)
Add a bond to this Sgroup.void
addBracket(SgroupBracket bracket)
Add a bracket for this Sgroup.void
addParent(Sgroup parent)
Add a parent Sgroup.<T> T
downcast()
Downcast this, maybe generic, Sgroup to a specific concrete implementation.Set<IAtom>
getAtoms()
Access the atoms of this substructure group.Set<SgroupKey>
getAttributeKeys()
Access all the attribute keys of this Sgroup.Set<IBond>
getBonds()
Access the bonds that belong to this substructure group.Set<Sgroup>
getParents()
Access the parents of this Sgroup.String
getSubscript()
Access the subscript value.SgroupType
getType()
Access the type of the Sgroup.<T> T
getValue(SgroupKey key)
Access an attribute for the Sgroup.void
putValue(SgroupKey key, Object val)
Store an attribute for the Sgroup.void
removeAtom(IAtom atom)
Remove an atom from this Sgroup.void
removeBond(IBond bond)
Remove a bond from this Sgroup.void
removeParents(Collection<Sgroup> parents)
Remove the specified parent associations from this Sgroup.void
setSubscript(String label)
Set the subscript value.void
setType(SgroupType type)
Set the type of the Sgroup.
-
-
-
Method Detail
-
getAttributeKeys
public final Set<SgroupKey> getAttributeKeys()
Access all the attribute keys of this Sgroup.- Returns:
- attribute keys
-
setType
public final void setType(SgroupType type)
Set the type of the Sgroup.
-
getType
public final SgroupType getType()
Access the type of the Sgroup.
-
getAtoms
public final Set<IAtom> getAtoms()
Access the atoms of this substructure group.- Returns:
- unmodifiable atom set
-
getBonds
public final Set<IBond> getBonds()
Access the bonds that belong to this substructure group. For data Sgroups, the bonds are the containment bonds, for all other Sgroup types, they are crossing bonds.- Returns:
- unmodifiable bond set
-
getParents
public final Set<Sgroup> getParents()
Access the parents of this Sgroup.- Returns:
- parents
-
addAtom
public final void addAtom(IAtom atom)
Add an atom to this Sgroup.- Parameters:
atom
- the atom
-
removeAtom
public final void removeAtom(IAtom atom)
Remove an atom from this Sgroup.- Parameters:
atom
- the atom
-
addBond
public final void addBond(IBond bond)
Add a bond to this Sgroup. The bond list- Parameters:
bond
- bond to add
-
removeBond
public final void removeBond(IBond bond)
Remove a bond from this Sgroup.- Parameters:
bond
- the bond
-
addParent
public final void addParent(Sgroup parent)
Add a parent Sgroup.- Parameters:
parent
- parent sgroup
-
removeParents
public final void removeParents(Collection<Sgroup> parents)
Remove the specified parent associations from this Sgroup.- Parameters:
parents
- parent associations
-
putValue
public void putValue(SgroupKey key, Object val)
Store an attribute for the Sgroup.- Parameters:
key
- attribute keyval
- attribute value
-
getValue
public <T> T getValue(SgroupKey key)
Access an attribute for the Sgroup.- Parameters:
key
- attribute key
-
getSubscript
public final String getSubscript()
Access the subscript value.- Returns:
- subscript value (or null if not present)
-
setSubscript
public final void setSubscript(String label)
Set the subscript value.
-
addBracket
public final void addBracket(SgroupBracket bracket)
Add a bracket for this Sgroup.- Parameters:
bracket
- sgroup bracket
-
downcast
public <T> T downcast()
Downcast this, maybe generic, Sgroup to a specific concrete implementation. This method should be called on load by a reader once all data has been added to the sgroup.- Type Parameters:
T
- return type- Returns:
- downcast instance
-
-