Package org.openscience.cdk.sgroup
Class Sgroup
java.lang.Object
org.openscience.cdk.sgroup.Sgroup
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 -
Method Summary
Modifier and TypeMethodDescriptionfinal void
Add an atom to this Sgroup.final void
Add a bond to this Sgroup.final void
addBracket
(SgroupBracket bracket) Add a bracket for this Sgroup.final void
Add a parent Sgroup.<T> T
downcast()
Downcast this, maybe generic, Sgroup to a specific concrete implementation.getAtoms()
Access the atoms of this substructure group.Access all the attribute keys of this Sgroup.getBonds()
Access the bonds that belong to this substructure group.Access the parents of this Sgroup.final String
Access the subscript value.final SgroupType
getType()
Access the type of the Sgroup.<T> T
Access an attribute for the Sgroup.void
Store an attribute for the Sgroup.final void
removeAtom
(IAtom atom) Remove an atom from this Sgroup.final void
removeBond
(IBond bond) Remove a bond from this Sgroup.final void
removeParents
(Collection<Sgroup> parents) Remove the specified parent associations from this Sgroup.final void
setSubscript
(String label) Set the subscript value.final void
setType
(SgroupType type) Set the type of the Sgroup.
-
Constructor Details
-
Sgroup
public Sgroup()Create a new generic Sgroup.
-
-
Method Details
-
getAttributeKeys
Access all the attribute keys of this Sgroup.- Returns:
- attribute keys
-
setType
Set the type of the Sgroup. -
getType
Access the type of the Sgroup. -
getAtoms
Access the atoms of this substructure group.- Returns:
- unmodifiable atom set
-
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
Access the parents of this Sgroup.- Returns:
- parents
-
addAtom
Add an atom to this Sgroup.- Parameters:
atom
- the atom
-
removeAtom
Remove an atom from this Sgroup.- Parameters:
atom
- the atom
-
addBond
Add a bond to this Sgroup. The bond list- Parameters:
bond
- bond to add
-
removeBond
Remove a bond from this Sgroup.- Parameters:
bond
- the bond
-
addParent
Add a parent Sgroup.- Parameters:
parent
- parent sgroup
-
removeParents
Remove the specified parent associations from this Sgroup.- Parameters:
parents
- parent associations
-
putValue
Store an attribute for the Sgroup.- Parameters:
key
- attribute keyval
- attribute value
-
getValue
Access an attribute for the Sgroup.- Parameters:
key
- attribute key
-
getSubscript
Access the subscript value.- Returns:
- subscript value (or null if not present)
-
setSubscript
Set the subscript value. -
addBracket
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
-