Package chemaxon.struc
Class Sgroup
- java.lang.Object
-
- chemaxon.struc.Sgroup
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
DataSgroup
,MulticenterSgroup
,MultipleSgroup
,RepeatingUnitSgroup
,SuperatomSgroup
@PublicAPI public class Sgroup extends Object implements Serializable
Structural group representation in the molecule.
A structural group is an entity in the molecule. Some of these entities has direct subclasses.
Some example use cases:- It can be an abbreviation of a molecule part represented as
SuperatomSgroup
. - A repeating unit in the molecule represented as
RepeatingUnitSgroup
. - Data assigned to a part of the molecule represented as
DataSgroup
. - A bond which has connection to multiple atom in the molecule is represented as multicenter sgroup type.
- Components in the molecule can be represented as component sgroups.
See also the possible return values of
getType()
method which describes the possible sgroup types.
Some relevant functions in the molecule to handle these structural elements:Molecule.addSgroup(Sgroup, boolean)
Molecule.expandSgroups()
Molecule.findAllSgroupContaining(MolAtom)
Molecule.findContainingMulticenterSgroup(MolAtom)
Molecule.findContractableSgroup()
Molecule.findExpandableSgroup()
Molecule.findSgroupContaining(MolAtom)
Molecule.findSgroupOf(MolAtom)
Molecule.findSmallestSgroupContaining(MolAtom)
Molecule.getRootSgroups()
Molecule.getSgroup(int)
Molecule.getSgroupArray()
Molecule.getSgroupCount()
Molecule.getSgroupLigands()
Molecule.getSortedSgroups()
Molecule.isGUIContracted()
Molecule.removeSgroupFromList(Sgroup)
Molecule.removeSgroupsOf(Molecule)
Molecule.setSgroupParent(MolAtom, Sgroup, boolean)
Molecule.ungroupSgroup(int)
See also example code snippets about Sgroups.
- Since:
- Marvin 3.0
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Set<MolAtom>
atomSet
Set for storing the atoms of the s-group's graph.protected ArrayList<MBracket>
brackets
static int
CHARGE_ON_ATOMS
Charge is located on atoms and displayed on atoms.static int
CHARGE_ON_GROUP
Charge is located on atoms but displayed on the whole group (bracket).protected Sgroup
parentSgroup
static int
PR_ATSYMS
Print atom symbols.protected static int
RA_IN_EXPAND
Atom removal in expand.protected static int
RA_REMOVE_EXCEPT_RU
Replace without duplicating.static int
SCN_EITHER_UNKNOWN
Either unknown S-group connectivity.static int
SCN_HEAD_TO_HEAD
Head-to-head S-group connectivity.static int
SCN_HEAD_TO_TAIL
Head-to-tail S-group connectivity.static int
SGROUP_TYPE_COUNT
Number of S-group types.protected SelectionMolecule
sgroupGraph
The S-group's internal structure.protected int
sgroupType
The S-group type.static int
SORT_CHILD_PARENT
Parent-child sort order.static int
SORT_PARENT_CHILD
Parent-child sort order.static int
SST_ALTERNATING
Alternating polymer S-group subtype.static int
SST_BLOCK
Block polymer S-group subtype.static int
SST_RANDOM
Random polymer S-group subtype.static int
ST_AMINOACID
Amino acid s-group type.static int
ST_ANY
Any polymer S-group type.static int
ST_COMPONENT
Component S-group type.static int
ST_COPOLYMER
Copolymer S-group type.static int
ST_CROSSLINK
Crosslink S-group type.static int
ST_DATA
Data S-group type.static int
ST_FORMULATION
Formulation S-group type.static int
ST_GENERIC
Generic S-group type.static int
ST_GRAFT
Graft S-group type.static int
ST_MER
Mer S-group type.static int
ST_MIXTURE
Mixture S-group type.static int
ST_MODIFICATION
Modification S-group type.static int
ST_MONOMER
Monomer S-group type.static int
ST_MULTICENTER
Multicenter S-group type.static int
ST_MULTIPLE
Multiple group S-group type.static int
ST_SRU
SRU (Structural Repeating Unit: polymers and repeating units with repetition ranges) S-group type.static int
ST_SUPERATOM
Superatom S-group type.static int
XSTATE_C
S-group is contracted (useful only in GUI!).static int
XSTATE_NONE
S-group is in an undetermined state.static int
XSTATE_X
S-group is expanded.static int
XSTATE_XC
S-group is expanded but its atoms have the same coordinates as in contracted state.
-
Constructor Summary
Constructors Modifier Constructor Description Sgroup(Molecule parent, int t)
Deprecated.As of Marvin 5.12, replaced bySgroupFactory.createSgroup(Molecule, SgroupType)
.Sgroup(Molecule parent, int t, int xstate)
Deprecated.As of Marvin 5.12, replaced bySgroupFactory.createSgroup(Molecule, SgroupType)
andsetXState(int)
.protected
Sgroup(Molecule parent, SgroupType type)
protected
Sgroup(Molecule parent, SgroupType type, int xstate)
protected
Sgroup(Sgroup sg, Molecule m, Sgroup psg)
Copy constructor.protected
Sgroup(Sgroup sg, Molecule m, Sgroup psg, int[] iatoms)
Copy constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
add(MolAtom a)
Adds a new atom to the S-group.void
addBracket(MBracket bracket)
Adds a bracket to this S-group.void
addChildSgroup(Sgroup sg)
Adds a child S-group.boolean
areChildSgroupsVisible()
Checks whether the child S-groups are visible.protected void
checkBondConsistency()
protected void
checkBonds(MolAtom atom)
Add the bonds of the given atom to the sgroup if the given atom and the other atom of the selected bond is in the sgroup.boolean
checkConsistencyInEmbeddings()
Checks if the sgroup contains all of the child sgroup's atoms and checks consistency between atom and bond references.protected boolean
checkSgroupGraphConsistency(Sgroup parentSgroup)
Checks whether the parameter s-group contains the atoms of this s-group.void
clearObjects()
Clears all MObject-s that belong to this S-groups.Sgroup
cloneSgroup(Molecule m, Sgroup psg)
Gets a new Sgroup instance.protected Sgroup
cloneSgroup(Molecule m, Sgroup psg, int[] atomIndexMap)
Gets a new Sgroup instance.SelectionMolecule
cloneStructure()
Gets the clone of the structure stored.boolean
contains(MolAtom atom)
Is this atom contained by the s-group?boolean
containsAllAtomsOf(Sgroup sg)
Checks if the S-group contains the atoms of another S-group.protected boolean
contract(int opts)
Sets the state toXSTATE_C
.int
countAllAtoms()
Counts the total number of atoms recursively.Molecule
createMolecule()
Creates a molecule object that contains only this group.Sgroup
createMolecule(Molecule m)
Creates a cloned sgroup instance and a molecule object that contains only this sgroup.protected boolean
expand(int f)
MolBond[]
findCrossingBonds()
Finds the crossing bonds.Sgroup
findSmallestSgroupContaining(MolAtom a)
Finds the smallest S-group containing the specified node.Sgroup
findSmallestSgroupOf(MolAtom a)
Finds the smallest S-group that has the specified node.MolAtom
getAtom(int i)
Gets an atom in the S-group.MolAtom[]
getAtomArray()
Gets the array of atoms in the S-group.int
getAtomCount()
Gets the number of atoms in the S-group.protected static String
getAtomSymbolListAsString(MolAtom[] atoms)
protected static int
getAttach(MolAtom atom)
Gets the attachment point information from the ExtraAtomPropertiesMolBond[]
getBondArray()
Gets all bonds connecting two atoms that are both in the Sgroupint
getBracketCount()
Gets the number of brackets in this S-group.ArrayList<MBracket>
getBrackets()
Gets all graphic brackets from this Sgroupint
getChargeLocation()
Returns the charge location attribute of the S-group.Sgroup
getChildSgroup(int i)
Gets a child S-group.int
getChildSgroupCount()
Gets the number of child S-groups.protected Sgroup[]
getChildSgroups()
Gets the children of this S-group.int
getConnectivity()
Gets S-group connectivity.MolAtom[]
getCrossingAtoms(MolBond[] xbonds)
Gets the atoms that have crossing bonds.String
getId()
Molecule
getParentMolecule()
Gets the parent molecule.Sgroup
getParentSgroup()
Gets the parent S-group.SelectionMolecule
getSgroupGraph()
Gets a COPY of the molecule graph.SgroupType
getSgroupType()
Gets the S-group type.String
getSubscript()
Gets the subscript for non-superatom S-groups.int
getSubType()
Gets polymer S-group subtype.String
getSuperscript()
Gets the superscript for non-superatom S-groups.int
getTotalCharge()
Calculates the sum of the charge values on the atoms in this S-group.int
getType()
Deprecated.as of Marvin 6.3.int
getXState()
Gets the expanded/contracted state.boolean
hasAtom(MolAtom a)
Is the specified atom an element of this group?boolean
hasBrackets()
Checks if brackets should be painted or not.int
indexOf(MolAtom a)
Gets the atom index in the S-group graph.int
indexOf(MolBond b)
Gets the bond index in the S-group graph.void
initBrackets()
Initializes the list of brackets in this S-group.boolean
isBracketCrossingBond(MolBond bond)
boolean
isBracketVisible()
Tests whether the bracket is visible.boolean
isDescendantOf(Sgroup psg)
Decides whether this is a descendant of another sgroup.boolean
isEmpty()
Is it an empty S-group?boolean
isOrderedComponentSgroup()
Returns if the Sgroup is ordered component Sgroup.boolean
isPartSelected(MoleculeGraph sel)
Decides if part of the sgroup is selected or not.boolean
isRemovable()
Decides whether an S-group should be ungrouped if its structure changes.boolean
isSelected(MoleculeGraph sel)
Is the sgroup or part of the sgroup selected?boolean
isTotalSelected(MoleculeGraph sel)
Decides if the whole sgroup is selected or not.boolean
isVisible()
Checks whether this group is 'visible' (all parents are expanded in case of superatom S-groups) or not.void
removeAtom(MolAtom a)
Removes an atom and its bonds from the S-group.protected void
removeAtom(MolAtom a, int opts)
Removes an atom and its bonds from the S-group.protected static void
removeAtom(Sgroup sg, MolAtom a, int opts)
Wrapper method that callsremoveAtom(MolAtom, int)
of sg.protected void
removeBond(MolBond b)
Removes a bond from the S-group.void
removeBonds()
Removes the edge references.void
removeChildSgroup(Sgroup sg)
Removes an S-group from the children list.protected static void
removeGroupedAtom(MoleculeGraph m, MolAtom a, MolBond[] v, int opts)
Removes an atom from the molecule and remove its specified bonds.void
removeObject(MObject mo)
Removes the specified MObject from this Sgroup.void
replaceAtom(MolAtom olda, MolAtom newa)
Replace an existing atom by a new one in this S-group and its parent (recursively).void
replaceAtom(MolAtom olda, MolAtom newa, int opts)
Replace an existing atom by a new one in this S-group and its parent (recursively).void
selectAllObjects(boolean s)
Sets the selection state of the MObject-s that belong to this Sgroup.void
setAtom(int i, MolAtom a)
Sets the specified atom in the S-group graph.void
setChargeLocation(int location)
Sets the charge location attribute of the S-group.void
setConnectivity(int c)
Sets S-group connectivity.boolean
setGUIStateRecursively(boolean v)
Deprecated.as of Marvin 6.2 useMolecule.setGUIContracted(boolean)
, orMolecule.setGUIContracted(boolean, int)
methods for such functionalityboolean
setGUIStateRecursively(boolean contract, int opts)
Deprecated.as of Marvin 6.2 useMolecule.setGUIContracted(boolean)
, orMolecule.setGUIContracted(boolean, int)
methods for such functionalityvoid
setId(String id)
protected void
setParentMolecule(Molecule p)
Sets the parent molecule.void
setSgroupGraph(SelectionMolecule smol)
Sets the molecule graph.void
setSubscript(String s)
Sets the subscript for non-superatom S-groups.void
setSubType(int t)
Sets polymer S-group subtype.void
setXState(int state)
Sets the expanded/contracted state.void
setXState(int state, int opts)
Deprecated.as of Marvin 6.2, usesetXState(int)
insteadprotected void
setXState0(int state)
static void
sort(Sgroup[] sgroups, int o)
Sorts S-groups in parent-child or child-parent order.String
toString()
Overrides Object.toString() to ease debugging.String
toString(int opts)
Gets a string representation of the S-group.protected void
transformByParent(CTransform3D t, boolean incg)
Applies a transformation matrix to the coordinates.
-
-
-
Field Detail
-
SGROUP_TYPE_COUNT
public static final int SGROUP_TYPE_COUNT
Number of S-group types. @see #getType()- See Also:
- Constant Field Values
-
ST_SUPERATOM
public static final int ST_SUPERATOM
Superatom S-group type. @see #getType()- See Also:
- Constant Field Values
-
ST_MULTIPLE
public static final int ST_MULTIPLE
Multiple group S-group type. @see #getType()- See Also:
- Constant Field Values
-
ST_SRU
public static final int ST_SRU
SRU (Structural Repeating Unit: polymers and repeating units with repetition ranges) S-group type.- See Also:
getType()
, Constant Field Values
-
ST_MONOMER
public static final int ST_MONOMER
Monomer S-group type. @see #getType()- See Also:
- Constant Field Values
-
ST_MER
public static final int ST_MER
Mer S-group type. @see #getType()- See Also:
- Constant Field Values
-
ST_COPOLYMER
public static final int ST_COPOLYMER
Copolymer S-group type. @see #getType()- See Also:
- Constant Field Values
-
ST_CROSSLINK
public static final int ST_CROSSLINK
Crosslink S-group type. @see #getType()- See Also:
- Constant Field Values
-
ST_MODIFICATION
public static final int ST_MODIFICATION
Modification S-group type. @see #getType()- See Also:
- Constant Field Values
-
ST_MIXTURE
public static final int ST_MIXTURE
Mixture S-group type. Mixture S-groups are composed from unordered component S-groups.- See Also:
ST_COMPONENT
,getType()
, Constant Field Values
-
ST_FORMULATION
public static final int ST_FORMULATION
Formulation S-group type. Formulation S-groups are composed from ordered component S-groups.- See Also:
ST_COMPONENT
,getType()
, Constant Field Values
-
ST_DATA
public static final int ST_DATA
Data S-group type. @see #getType()- See Also:
- Constant Field Values
-
ST_ANY
public static final int ST_ANY
Any polymer S-group type. @see #getType()- See Also:
- Constant Field Values
-
ST_GENERIC
public static final int ST_GENERIC
Generic S-group type. @see #getType()- See Also:
- Constant Field Values
-
ST_COMPONENT
public static final int ST_COMPONENT
Component S-group type. A component here is a set of atoms contained by a component bracket. There are two kind of component S-group: ordered and unordered. The subscript of an unordered S-group contains a simple "c". The subscript of an ordered component S-group contains an additional integer e.g.: "c1" where "1" is the order of the ordered component S-group. Ordered component S-groups can be embedded into formulation S-groups. Unordered component S-groups can be embedded into mixture S-groups.- See Also:
ST_FORMULATION
,ST_MIXTURE
,getSubscript()
,getType()
, Constant Field Values
-
ST_MULTICENTER
public static final int ST_MULTICENTER
Multicenter S-group type. @see #getSubType()- See Also:
- Constant Field Values
-
ST_GRAFT
public static final int ST_GRAFT
Graft S-group type. @see #getType()- See Also:
- Constant Field Values
-
ST_AMINOACID
public static final int ST_AMINOACID
Amino acid s-group type. @see #getType()- See Also:
- Constant Field Values
-
SST_ALTERNATING
public static final int SST_ALTERNATING
Alternating polymer S-group subtype. @see #getSubType()- See Also:
- Constant Field Values
-
SST_RANDOM
public static final int SST_RANDOM
Random polymer S-group subtype. @see #getSubType()- See Also:
- Constant Field Values
-
SST_BLOCK
public static final int SST_BLOCK
Block polymer S-group subtype. @see #getSubType()- See Also:
- Constant Field Values
-
SCN_EITHER_UNKNOWN
public static final int SCN_EITHER_UNKNOWN
Either unknown S-group connectivity. @see #getConnectivity()- See Also:
- Constant Field Values
-
SCN_HEAD_TO_HEAD
public static final int SCN_HEAD_TO_HEAD
Head-to-head S-group connectivity. @see #getConnectivity()- See Also:
- Constant Field Values
-
SCN_HEAD_TO_TAIL
public static final int SCN_HEAD_TO_TAIL
Head-to-tail S-group connectivity. @see #getConnectivity()- See Also:
- Constant Field Values
-
XSTATE_NONE
public static final int XSTATE_NONE
S-group is in an undetermined state.- Since:
- Marvin 3.4, 05/04/2004
- See Also:
setXState(int)
, Constant Field Values
-
XSTATE_X
public static final int XSTATE_X
S-group is expanded.- Since:
- Marvin 3.4, 05/04/2004
- See Also:
setXState(int)
, Constant Field Values
-
XSTATE_C
public static final int XSTATE_C
S-group is contracted (useful only in GUI!).- Since:
- Marvin 3.4, 05/04/2004
- See Also:
setXState(int)
, Constant Field Values
-
XSTATE_XC
public static final int XSTATE_XC
S-group is expanded but its atoms have the same coordinates as in contracted state.- Since:
- Marvin 3.4, 05/04/2004
- See Also:
setXState(int)
, Constant Field Values
-
SORT_PARENT_CHILD
public static final int SORT_PARENT_CHILD
Parent-child sort order.- Since:
- Marvin 3.4
- See Also:
sort(Sgroup[], int)
, Constant Field Values
-
SORT_CHILD_PARENT
public static final int SORT_CHILD_PARENT
Parent-child sort order.- Since:
- Marvin 3.4
- See Also:
sort(Sgroup[], int)
, Constant Field Values
-
PR_ATSYMS
public static final int PR_ATSYMS
Print atom symbols.- Since:
- Marvin 4.1, 07/26/2006
- See Also:
- Constant Field Values
-
RA_IN_EXPAND
protected static final int RA_IN_EXPAND
Atom removal in expand.- Since:
- Marvin 4.1, 07/27/2006
- See Also:
removeAtom(MolAtom, int)
, Constant Field Values
-
RA_REMOVE_EXCEPT_RU
protected static final int RA_REMOVE_EXCEPT_RU
Replace without duplicating.- Since:
- Marvin 4.1, 07/27/2006
- See Also:
replaceAtom(MolAtom, MolAtom, int)
, Constant Field Values
-
CHARGE_ON_ATOMS
public static final int CHARGE_ON_ATOMS
Charge is located on atoms and displayed on atoms.- Since:
- Marvin 5.2, 01/22/2009
- See Also:
getChargeLocation()
,setChargeLocation(int)
, Constant Field Values
-
CHARGE_ON_GROUP
public static final int CHARGE_ON_GROUP
Charge is located on atoms but displayed on the whole group (bracket).- Since:
- Marvin 5.2, 01/22/2009
- See Also:
getChargeLocation()
,setChargeLocation(int)
, Constant Field Values
-
parentSgroup
protected transient Sgroup parentSgroup
-
sgroupType
protected transient int sgroupType
The S-group type.
-
sgroupGraph
protected transient SelectionMolecule sgroupGraph
The S-group's internal structure.
-
-
Constructor Detail
-
Sgroup
@Deprecated public Sgroup(Molecule parent, int t)
Deprecated.As of Marvin 5.12, replaced bySgroupFactory.createSgroup(Molecule, SgroupType)
.Creates an S-group with the specified parent and type.- Parameters:
parent
- the parent moleculet
- S-group type
-
Sgroup
@Deprecated public Sgroup(Molecule parent, int t, int xstate)
Deprecated.As of Marvin 5.12, replaced bySgroupFactory.createSgroup(Molecule, SgroupType)
andsetXState(int)
.Creates an S-group with the specified parent and type.- Parameters:
parent
- the parent moleculet
- S-group typexstate
- the expanded state- Since:
- Marvin 3.4, 05/04/2004
- See Also:
setXState(int)
-
Sgroup
protected Sgroup(Molecule parent, SgroupType type)
-
Sgroup
protected Sgroup(Molecule parent, SgroupType type, int xstate)
-
Sgroup
protected Sgroup(Sgroup sg, Molecule m, Sgroup psg)
Copy constructor.- Parameters:
sg
- the S-group to copym
- the new parent moleculepsg
- the new parent S-group or null- Since:
- Marvin 3.4
-
-
Method Detail
-
getId
public String getId()
-
setId
public void setId(String id)
-
setSgroupGraph
public void setSgroupGraph(SelectionMolecule smol)
Sets the molecule graph.- Parameters:
smol
- the molecule graph- Since:
- Marvin 3.3, 11/03/2003
-
getSgroupGraph
public SelectionMolecule getSgroupGraph()
Gets a COPY of the molecule graph. WARNING! If the returned selection molecule is changed then the graph of the S-group remains unchanged!- Returns:
- the molecule graph
- Since:
- Marvin 3.3, 11/03/2003
-
setParentMolecule
protected final void setParentMolecule(Molecule p)
Sets the parent molecule.- Parameters:
p
- the parent molecule
-
getParentMolecule
public final Molecule getParentMolecule()
Gets the parent molecule.- Returns:
- the parent molecule
-
getChildSgroupCount
public final int getChildSgroupCount()
Gets the number of child S-groups.- Returns:
- the number of children
- Since:
- Marvin 3.4
-
getChildSgroup
public final Sgroup getChildSgroup(int i)
Gets a child S-group.- Parameters:
i
- the child index- Returns:
- the child
- Since:
- Marvin 3.4
-
addChildSgroup
public final void addChildSgroup(Sgroup sg)
Adds a child S-group.- Parameters:
sg
- the child- Since:
- Marvin 3.4
-
removeChildSgroup
public final void removeChildSgroup(Sgroup sg)
Removes an S-group from the children list.- Parameters:
sg
- the child to remove- Since:
- Marvin 4.0.4, 01/04/2006
-
findSmallestSgroupContaining
public final Sgroup findSmallestSgroupContaining(MolAtom a)
Finds the smallest S-group containing the specified node. If this parent contains the node, then it searches the children recursively.- Parameters:
a
- the node- Returns:
- the S-group or null if not found
- Since:
- Marvin 3.4, 05/05/2004
-
contains
public boolean contains(MolAtom atom)
Is this atom contained by the s-group?- Parameters:
atom
- the atom that's may be part of this s-group- Returns:
- true it the referenced atom is contained by this s-group, false otherwise
-
findSmallestSgroupOf
public final Sgroup findSmallestSgroupOf(MolAtom a)
Finds the smallest S-group that has the specified node. If this parent has the node, then it searches the children recursively.- Parameters:
a
- the node- Returns:
- the S-group or null if not found
- Since:
- Marvin 3.4, 05/05/2004
-
getParentSgroup
public final Sgroup getParentSgroup()
Gets the parent S-group.- Returns:
- the parent S-group
- Since:
- Marvin 3.4
-
getXState
public final int getXState()
Gets the expanded/contracted state.
-
setXState
public final void setXState(int state)
Sets the expanded/contracted state.- Parameters:
state
- the expanded/contracted state- Throws:
IllegalArgumentException
- if the group is invisible (it has a non-expanded parent)- Since:
- Marvin 3.4, 05/04/2004
- See Also:
XSTATE_X
,XSTATE_C
,XSTATE_XC
-
setXState
@Deprecated public final void setXState(int state, int opts) throws IllegalArgumentException
Deprecated.as of Marvin 6.2, usesetXState(int)
insteadSets the expanded/contracted state.- Parameters:
state
- the expanded/contracted stateopts
- option for updating coordinates- Throws:
IllegalArgumentException
- if the group is invisible (it has a non-expanded parent)- Since:
- Marvin 3.4, 05/04/2004
- See Also:
XSTATE_X
,XSTATE_C
,XSTATE_XC
-
setXState0
protected void setXState0(int state)
-
setGUIStateRecursively
@Deprecated public boolean setGUIStateRecursively(boolean v)
Deprecated.as of Marvin 6.2 useMolecule.setGUIContracted(boolean)
, orMolecule.setGUIContracted(boolean, int)
methods for such functionalitySets the expanded/contracted state recursively.- Parameters:
v
- true setsXSTATE_C
if previous state wasXSTATE_XC
, false setsXSTATE_XC
if previous state wasXSTATE_C
, no operation in other cases- Returns:
- true if at least one S-group's state was changed, false otherwise
- Throws:
IllegalArgumentException
- if the group is invisible (it has a non-expanded parent)- Since:
- Marvin 3.4, 05/04/2004
- See Also:
setXState(int)
-
setGUIStateRecursively
@Deprecated public boolean setGUIStateRecursively(boolean contract, int opts) throws IllegalArgumentException
Deprecated.as of Marvin 6.2 useMolecule.setGUIContracted(boolean)
, orMolecule.setGUIContracted(boolean, int)
methods for such functionalitySets the expanded/contracted state recursively.- Parameters:
contract
- true setsXSTATE_C
if previous state wasXSTATE_XC
, false setsXSTATE_XC
if previous state wasXSTATE_C
, no operation in other casesopts
- the expansion/contraction options- Returns:
- true if at least one S-group's state was changed, false otherwise
- Throws:
IllegalArgumentException
- if the group is invisible (it has a non-expanded parent)- Since:
- Marvin 3.4, 05/04/2004
- See Also:
setXState(int)
,Expandable.COORDS_UPDATE
-
expand
protected boolean expand(int f) throws IllegalArgumentException
- Parameters:
f
- options, only theExpandable.LEAVE_COORDS_UNCHANGED
and theExpandable.MDL_EXPAND
flags are taken into account- Returns:
- true
- Throws:
IllegalArgumentException
- if the group is invisible (it has a non-expanded parent)- Since:
- Marvin 3.4, 05/04/2004
- See Also:
setXState(int)
-
contract
protected boolean contract(int opts) throws IllegalArgumentException
Sets the state toXSTATE_C
.- Parameters:
opts
- neglected- Returns:
- true
- Throws:
IllegalArgumentException
- if the group is invisible (it has a non-expanded parent)- Since:
- Marvin 3.4, 05/04/2004
- See Also:
setXState(int)
-
getSuperscript
public String getSuperscript()
Gets the superscript for non-superatom S-groups.- Returns:
- the superscript
-
isOrderedComponentSgroup
public boolean isOrderedComponentSgroup()
Returns if the Sgroup is ordered component Sgroup.- Since:
- Marvin 4.1.1, 08/30/2006
-
getSubscript
public String getSubscript()
Gets the subscript for non-superatom S-groups.- Returns:
- the subscript
-
setSubscript
public void setSubscript(String s)
Sets the subscript for non-superatom S-groups.- Parameters:
s
- the subscript
-
getType
@Deprecated public int getType()
Deprecated.as of Marvin 6.3. usegetSgroupType()
instead. Note that in case ofAminoAcidSgroup
s returnedST_SUPERATOM
butgetSgroupType()
will returnSgroupType.AMINOACID
.Gets S-group type.- Returns:
- the type
- See Also:
ST_SUPERATOM
,ST_MULTIPLE
,ST_SRU
,ST_MONOMER
,ST_MER
,ST_COPOLYMER
,ST_CROSSLINK
,ST_MODIFICATION
,ST_MIXTURE
,ST_FORMULATION
,ST_DATA
,ST_ANY
,ST_GENERIC
,ST_MULTICENTER
,ST_GRAFT
-
getSgroupType
public SgroupType getSgroupType()
Gets the S-group type.- Returns:
- the type of the S-group
- See Also:
SgroupType
-
getSubType
public int getSubType()
Gets polymer S-group subtype.- Returns:
- the type
- See Also:
SST_ALTERNATING
,SST_RANDOM
,SST_BLOCK
-
setSubType
public void setSubType(int t)
Sets polymer S-group subtype.- Parameters:
t
- the type- See Also:
getSubType()
-
getConnectivity
public int getConnectivity()
Gets S-group connectivity.- Returns:
- the connectivity
- See Also:
SCN_EITHER_UNKNOWN
,SCN_HEAD_TO_HEAD
,SCN_HEAD_TO_TAIL
-
setConnectivity
public void setConnectivity(int c)
Sets S-group connectivity.- Parameters:
c
- the connectivity- See Also:
getConnectivity()
-
hasBrackets
public boolean hasBrackets()
Checks if brackets should be painted or not.- Returns:
- always true in the default implementation
- Since:
- Marvin 3.3
-
cloneStructure
public final SelectionMolecule cloneStructure()
Gets the clone of the structure stored.- Returns:
- the clone
-
createMolecule
public Molecule createMolecule()
Creates a molecule object that contains only this group.- Returns:
- the molecule
-
createMolecule
public Sgroup createMolecule(Molecule m)
Creates a cloned sgroup instance and a molecule object that contains only this sgroup.- Parameters:
m
- the molecule object- Returns:
- the cloned sgroup
- Since:
- Marvin 5.0, 09/01/2008
-
getAtomArray
public final MolAtom[] getAtomArray()
Gets the array of atoms in the S-group.- Returns:
- the atom array
-
getAtom
public final MolAtom getAtom(int i)
Gets an atom in the S-group.- Parameters:
i
- the atom index- Returns:
- the atom
-
countAllAtoms
public final int countAllAtoms()
Counts the total number of atoms recursively.- Returns:
- the number of atoms
-
isEmpty
public final boolean isEmpty()
Is it an empty S-group?- Returns:
- true if the S-group does not contain any atoms, false otherwise
-
cloneSgroup
public final Sgroup cloneSgroup(Molecule m, Sgroup psg)
Gets a new Sgroup instance.- Parameters:
m
- the new parent moleculepsg
- the new parent S-group- Returns:
- the new object
- Since:
- Marvin 3.4
-
cloneSgroup
protected Sgroup cloneSgroup(Molecule m, Sgroup psg, int[] atomIndexMap)
Gets a new Sgroup instance.- Parameters:
m
- the new parent moleculepsg
- the new parent S-groupatomIndexMap
- indices of cloned atoms in the original molecule ornull
- Returns:
- the new object
- Since:
- Marvin 5.0.2, 03/07/2008
-
getAtomCount
public final int getAtomCount()
Gets the number of atoms in the S-group.- Returns:
- the number of atoms
-
indexOf
public int indexOf(MolAtom a)
Gets the atom index in the S-group graph.- Parameters:
a
- the atom- Returns:
- the index or -1 if not found
-
indexOf
public int indexOf(MolBond b)
Gets the bond index in the S-group graph.- Parameters:
b
- the bond- Returns:
- the index or -1 if not found
- Since:
- Marvin 5.3.2
-
hasAtom
public boolean hasAtom(MolAtom a)
Is the specified atom an element of this group?- Parameters:
a
- the atom- Returns:
- true if it contains the atom, false otherwise
- Since:
- Marvin 3.4
-
containsAllAtomsOf
public boolean containsAllAtomsOf(Sgroup sg)
Checks if the S-group contains the atoms of another S-group.- Returns:
- true if this S-group contains the specified one
- Since:
- Marvin 3.4
-
add
public void add(MolAtom a)
Adds a new atom to the S-group.- Parameters:
a
- the atom
-
setAtom
public void setAtom(int i, MolAtom a)
Sets the specified atom in the S-group graph.- Parameters:
i
- the indexa
- the atom
-
removeBonds
public void removeBonds()
Removes the edge references.
-
removeAtom
public final void removeAtom(MolAtom a)
Removes an atom and its bonds from the S-group.- Parameters:
a
- the atom
-
removeAtom
protected void removeAtom(MolAtom a, int opts)
Removes an atom and its bonds from the S-group.- Parameters:
a
- the atomopts
- 0 orRA_IN_EXPAND
- Since:
- Marvin 4.1, 07/27/2006
-
removeAtom
protected static void removeAtom(Sgroup sg, MolAtom a, int opts)
Wrapper method that callsremoveAtom(MolAtom, int)
of sg. Needed by subclasses because they cannot call the protectedremoveAtom(MolAtom, int)
method of another Sgroup.- Parameters:
sg
- the other S-groupa
- the atomopts
- 0 orRA_IN_EXPAND
- Since:
- Marvin 4.1, 07/27/2006
-
removeBond
protected void removeBond(MolBond b)
Removes a bond from the S-group.- Parameters:
b
- the bond
-
replaceAtom
public final void replaceAtom(MolAtom olda, MolAtom newa)
Replace an existing atom by a new one in this S-group and its parent (recursively).- Parameters:
olda
- the original atomnewa
- the new atom- Since:
- 3.5.2, 12/15/2004
-
replaceAtom
public void replaceAtom(MolAtom olda, MolAtom newa, int opts)
Replace an existing atom by a new one in this S-group and its parent (recursively).- Parameters:
olda
- the original atomnewa
- the new atomopts
- options- Since:
- 4.1, 07/25/2006
- See Also:
RA_REMOVE_EXCEPT_RU
-
findCrossingBonds
public MolBond[] findCrossingBonds()
Finds the crossing bonds. Use only when the S-group is expanded.- Returns:
- the attachment bonds
- Since:
- Marvin 3.3
-
isBracketCrossingBond
public boolean isBracketCrossingBond(MolBond bond)
-
getCrossingAtoms
public MolAtom[] getCrossingAtoms(MolBond[] xbonds) throws IllegalArgumentException
Gets the atoms that have crossing bonds.- Parameters:
xbonds
- the crossing bonds- Returns:
- the attachment atoms
- Throws:
IllegalArgumentException
- if a bond in the specified array is not a crossing bond- Since:
- Marvin 3.3
-
removeGroupedAtom
protected static void removeGroupedAtom(MoleculeGraph m, MolAtom a, MolBond[] v, int opts)
Removes an atom from the molecule and remove its specified bonds.- Parameters:
m
- the molecule grapha
- the atomv
- bonds to remove from the atom, remove all bonds if nullopts
- the removal options- See Also:
MoleculeGraph.RMCLEANUP_NONE
,Molecule.RMCLEANUP_SGROUPATOMS
,Molecule.RMCLEANUP_FROMSGROUPS
,MoleculeGraph.removeAtom(int, int)
-
areChildSgroupsVisible
public boolean areChildSgroupsVisible()
Checks whether the child S-groups are visible.- Returns:
- true if children are visible, false otherwise
- Since:
- Marvin 3.4
-
isVisible
public final boolean isVisible()
Checks whether this group is 'visible' (all parents are expanded in case of superatom S-groups) or not.- Returns:
- true if the group is visible, false otherwise
- Since:
- Marvin 3.4
-
isBracketVisible
public boolean isBracketVisible()
Tests whether the bracket is visible.- Returns:
true
if visible,false
otherwise- Since:
- Marvin 3.5.1, 11/12/2004
-
transformByParent
protected void transformByParent(CTransform3D t, boolean incg)
Applies a transformation matrix to the coordinates. This method is called by the parent molecule'sMolecule.transform(CTransform3D, boolean)
method, thus only those atom coordinates are transformed here that are not handled inMoleculeGraph.transform(CTransform3D, boolean)
.- Parameters:
t
- the transformation matrixincg
- graph invariants are changed (true) or not (false)- Since:
- Marvin 4.0.2, 10/26/2005
-
sort
public static void sort(Sgroup[] sgroups, int o)
Sorts S-groups in parent-child or child-parent order.- Parameters:
sgroups
- the array to sorto
- the sort order- Since:
- Marvin 3.4
- See Also:
SORT_PARENT_CHILD
,SORT_CHILD_PARENT
-
toString
public final String toString()
Overrides Object.toString() to ease debugging. Returns a string consisting of the classname (without the package name!), the at-sign character `@
', and the unsigned hexadecimal representation of the hash code of the object.
-
toString
public String toString(int opts)
Gets a string representation of the S-group. Returns a string consisting of the classname (without the package name!), the at-sign character `@
', and the unsigned hexadecimal representation of the hash code of the object.- Parameters:
opts
- options or 0- Returns:
- a string representation of the object
- Since:
- Marvin 4.1, 07/26/2006
- See Also:
PR_ATSYMS
-
isDescendantOf
public boolean isDescendantOf(Sgroup psg)
Decides whether this is a descendant of another sgroup.- Parameters:
psg
- the other sgroup- Returns:
- true if this is a descendant of the other sgroup, false otherwise.
- Since:
- Marvin 5.0
-
isRemovable
public boolean isRemovable()
Decides whether an S-group should be ungrouped if its structure changes.- Returns:
- is true if the S-group is removable, false otherwise.
- See Also:
ST_MULTIPLE
,ST_SUPERATOM
-
isSelected
public boolean isSelected(MoleculeGraph sel)
Is the sgroup or part of the sgroup selected?- Parameters:
sel
- the molecule that contains the selected atoms- Returns:
- true if the sgroup contains at least one selected atom false otherwise.
- Since:
- Marvin 5.0, 04/02/2007
-
isTotalSelected
public boolean isTotalSelected(MoleculeGraph sel)
Decides if the whole sgroup is selected or not.- Parameters:
sel
- molecule graph that contains the selection- Returns:
- true if the whole sgroup is selected
- Since:
- Marvin 5.3.2, 10/01/2010
-
isPartSelected
public boolean isPartSelected(MoleculeGraph sel)
Decides if part of the sgroup is selected or not.- Parameters:
sel
- molecule graph that contains the selection- Returns:
- true if at least one of the sgroup atoms is selected, but the whole group is not
- Since:
- Marvin 5.3.2, 10/01/2010
-
clearObjects
public void clearObjects()
Clears all MObject-s that belong to this S-groups.- Since:
- Marvin 5.3, 11/30/2009
-
removeObject
public void removeObject(MObject mo)
Removes the specified MObject from this Sgroup.- Parameters:
mo
- the MObject to remove.- Since:
- Marvin 5.3, 11/30/2009
-
selectAllObjects
public void selectAllObjects(boolean s)
Sets the selection state of the MObject-s that belong to this Sgroup.- Parameters:
s
- the state value to set- Since:
- Marvin 5.3, 11/30/2009
-
addBracket
public void addBracket(MBracket bracket)
Adds a bracket to this S-group.- Parameters:
bracket
- the bracket to add- Since:
- Marvin 5.3, 11/30/2009
- See Also:
MBracket
-
initBrackets
public void initBrackets()
Initializes the list of brackets in this S-group. Creates an empty list of brackets if no brackets were added previously to the S-group, otherwise deletes the brackets from the existing list.- Since:
- Marvin 5.3, 11/30/2009
- See Also:
MBracket
-
getBracketCount
public int getBracketCount()
Gets the number of brackets in this S-group.- Returns:
- the number of brackets in this S-group.
- Since:
- Marvin 5.3, 11/30/2009
- See Also:
MBracket
-
getBrackets
public ArrayList<MBracket> getBrackets()
Gets all graphic brackets from this Sgroup- Returns:
- the list of brackets
- Since:
- Marvin 5.3, 11/30/2009
- See Also:
MBracket
-
getChargeLocation
public int getChargeLocation()
Returns the charge location attribute of the S-group.- Returns:
- charge location type:
CHARGE_ON_ATOMS
orCHARGE_ON_GROUP
. - Since:
- Marvin 5.2, 01/22/2009
- See Also:
CHARGE_ON_ATOMS
,CHARGE_ON_GROUP
-
setChargeLocation
public void setChargeLocation(int location)
Sets the charge location attribute of the S-group. Possible charge location types:CHARGE_ON_ATOMS
orCHARGE_ON_GROUP
.- Parameters:
location
- the charge location type to set- Since:
- Marvin 5.2, 01/22/2009
- See Also:
CHARGE_ON_ATOMS
,CHARGE_ON_GROUP
-
getTotalCharge
public int getTotalCharge()
Calculates the sum of the charge values on the atoms in this S-group.- Returns:
- the sum charge
- Since:
- Marvin 5.2, 01/22/2009
- See Also:
MolAtom.getCharge()
-
checkBonds
protected void checkBonds(MolAtom atom)
Add the bonds of the given atom to the sgroup if the given atom and the other atom of the selected bond is in the sgroup.- Parameters:
atom
- the given atom
-
getAttach
protected static int getAttach(MolAtom atom)
Gets the attachment point information from the ExtraAtomProperties- Parameters:
atom
- that attachment point is question.- Returns:
- the attachment point information from ExtraAtomProperties
- Since:
- Marvin 6.0, Dec 12, 2012
-
getBondArray
public MolBond[] getBondArray()
Gets all bonds connecting two atoms that are both in the Sgroup- Returns:
- sgroup's MolBond object array
- Since:
- Marvin 6.1, 04/29/2013
-
checkConsistencyInEmbeddings
public boolean checkConsistencyInEmbeddings()
Checks if the sgroup contains all of the child sgroup's atoms and checks consistency between atom and bond references.- Returns:
- true if the sgroup is consistent
-
checkBondConsistency
protected void checkBondConsistency()
-
checkSgroupGraphConsistency
protected boolean checkSgroupGraphConsistency(Sgroup parentSgroup)
Checks whether the parameter s-group contains the atoms of this s-group. It checks also that the parent molecule (if exists) contains these atoms as well.- Parameters:
parentSgroup
- parent of Sgroup- Returns:
- true if the s-group is consistent
-
getChildSgroups
protected Sgroup[] getChildSgroups()
Gets the children of this S-group.- Returns:
- Child S-groups as an array.
-
-