|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectchemaxon.struc.Sgroup
public class Sgroup
S-group.
Field Summary | |
---|---|
protected java.util.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_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 | |
---|---|
|
Sgroup(Molecule parent,
int t)
Creates an S-group with the specified parent and type. |
|
Sgroup(Molecule parent,
int t,
int xstate)
Creates an S-group with the specified parent and type. |
protected |
Sgroup(Sgroup sg,
Molecule m,
Sgroup psg)
Copy constructor. |
protected |
Sgroup(Sgroup sg,
Molecule m,
Sgroup psg,
int[] iatoms)
Copy constructor. |
Method Summary | |
---|---|
void |
add(MolAtom a)
Adds a new atom to the S-group. |
void |
add(MolBond bond)
|
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. |
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 |
containsAllAtomsOf(Sgroup sg)
Checks if the S-group contains the atoms of another S-group. |
protected boolean |
contract(int opts)
Sets the state to XSTATE_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)
Sets the state to XSTATE_X or XSTATE_XC . |
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 java.lang.String |
getAtomSymbolListAsString(MolAtom[] atoms)
|
int |
getBracketCount()
Gets the number of brackets in this S-group. |
java.util.ArrayList<MBracket> |
getBrackets()
Gets all graphic brackets from this Sgroup |
int |
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. |
int |
getConnectivity()
Gets S-group connectivity. |
MolAtom[] |
getCrossingAtoms(MolBond[] xbonds)
Gets the atoms that have crossing bonds. |
Molecule |
getParentMolecule()
Gets the parent molecule. |
Sgroup |
getParentSgroup()
Gets the parent S-group. |
SelectionMolecule |
getSgroupGraph()
Gets a COPY of the molecule graph. |
java.lang.String |
getSubscript()
Gets the subscript for non-superatom S-groups. |
int |
getSubType()
Gets polymer S-group subtype. |
java.lang.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()
Gets S-group type. |
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 wheter 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 calls removeAtom(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)
Sets the expanded/contracted state recursively. |
boolean |
setGUIStateRecursively(boolean v,
int opts)
Sets the expanded/contracted state recursively. |
protected void |
setParentMolecule(Molecule p)
Sets the parent molecule. |
void |
setSgroupGraph(SelectionMolecule smol)
Sets the molecule graph. |
void |
setSubscript(java.lang.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)
Sets the expanded/contracted state. |
protected void |
setXState0(int state)
|
static void |
sort(Sgroup[] sgroups,
int o)
Sorts S-groups in parent-child or child-parent order. |
java.lang.String |
toString()
Overrides Object.toString() to ease debugging. |
java.lang.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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int SGROUP_TYPE_COUNT
public static final int ST_SUPERATOM
public static final int ST_MULTIPLE
public static final int ST_SRU
getType()
,
Constant Field Valuespublic static final int ST_MONOMER
public static final int ST_MER
public static final int ST_COPOLYMER
public static final int ST_CROSSLINK
public static final int ST_MODIFICATION
public static final int ST_MIXTURE
ST_COMPONENT
,
getType()
,
Constant Field Valuespublic static final int ST_FORMULATION
ST_COMPONENT
,
getType()
,
Constant Field Valuespublic static final int ST_DATA
public static final int ST_ANY
public static final int ST_GENERIC
public static final int ST_COMPONENT
ST_FORMULATION
,
ST_MIXTURE
,
getSubscript()
,
getType()
,
Constant Field Valuespublic static final int ST_MULTICENTER
public static final int ST_GRAFT
public static final int SST_ALTERNATING
public static final int SST_RANDOM
public static final int SST_BLOCK
public static final int SCN_EITHER_UNKNOWN
public static final int SCN_HEAD_TO_HEAD
public static final int SCN_HEAD_TO_TAIL
public static final int XSTATE_NONE
setXState(int)
,
Constant Field Valuespublic static final int XSTATE_X
setXState(int)
,
Constant Field Valuespublic static final int XSTATE_C
setXState(int)
,
Constant Field Valuespublic static final int XSTATE_XC
setXState(int)
,
Constant Field Valuespublic static final int SORT_PARENT_CHILD
sort(Sgroup[], int)
,
Constant Field Valuespublic static final int SORT_CHILD_PARENT
sort(Sgroup[], int)
,
Constant Field Valuespublic static final int PR_ATSYMS
protected static final int RA_IN_EXPAND
removeAtom(MolAtom, int)
,
Constant Field Valuesprotected static final int RA_REMOVE_EXCEPT_RU
replaceAtom(MolAtom, MolAtom, int)
,
Constant Field Valuespublic static final int CHARGE_ON_ATOMS
getChargeLocation()
,
setChargeLocation(int)
,
Constant Field Valuespublic static final int CHARGE_ON_GROUP
getChargeLocation()
,
setChargeLocation(int)
,
Constant Field Valuesprotected transient Sgroup parentSgroup
protected transient int sgroupType
protected transient SelectionMolecule sgroupGraph
protected transient java.util.ArrayList<MBracket> brackets
Constructor Detail |
---|
public Sgroup(Molecule parent, int t)
parent
- the parent moleculet
- S-group typepublic Sgroup(Molecule parent, int t, int xstate)
parent
- the parent moleculet
- S-group typexstate
- the expanded statesetXState(int)
protected Sgroup(Sgroup sg, Molecule m, Sgroup psg)
sg
- the S-group to copym
- the new parent moleculepsg
- the new parent S-group or nullprotected Sgroup(Sgroup sg, Molecule m, Sgroup psg, int[] iatoms)
sg
- the S-group to copym
- the new parent moleculepsg
- the new parent S-group or nulliatoms
- indices of cloned atoms in the original molecule
or null
* @since Marvin 3.4Method Detail |
---|
public void setSgroupGraph(SelectionMolecule smol)
smol
- the molecule graphpublic SelectionMolecule getSgroupGraph()
protected final void setParentMolecule(Molecule p)
p
- the parent moleculepublic final Molecule getParentMolecule()
public final int getChildSgroupCount()
public final Sgroup getChildSgroup(int i)
i
- the child index
public final void addChildSgroup(Sgroup sg)
sg
- the childpublic final void removeChildSgroup(Sgroup sg)
sg
- the child to removepublic final Sgroup findSmallestSgroupContaining(MolAtom a)
a
- the node
public final Sgroup findSmallestSgroupOf(MolAtom a)
a
- the node
public final Sgroup getParentSgroup()
public final int getXState()
XSTATE_X
,
XSTATE_C
,
XSTATE_XC
public final void setXState(int state)
state
- the expanded/contracted state
java.lang.IllegalArgumentException
- if the group is invisible
(it has a non-expanded parent)XSTATE_X
,
XSTATE_C
,
XSTATE_XC
public final void setXState(int state, int opts) throws java.lang.IllegalArgumentException
state
- the expanded/contracted stateopts
- option for updating coordinates
java.lang.IllegalArgumentException
- if the group is invisible
(it has a non-expanded parent)XSTATE_X
,
XSTATE_C
,
XSTATE_XC
,
Expandable.COORDS_UPDATE
protected void setXState0(int state)
public boolean setGUIStateRecursively(boolean v)
v
- true sets XSTATE_C
if previous state was
XSTATE_XC
, false sets XSTATE_XC
if previous
state was XSTATE_C
, no operation in other cases
java.lang.IllegalArgumentException
- if the group is invisible
(it has a non-expanded parent)setXState(int)
public boolean setGUIStateRecursively(boolean v, int opts) throws java.lang.IllegalArgumentException
v
- true sets XSTATE_C
if previous state was
XSTATE_XC
, false sets XSTATE_XC
if previous
state was XSTATE_C
, no operation in other casesopts
- the expansion/contraction options
java.lang.IllegalArgumentException
- if the group is invisible
(it has a non-expanded parent)setXState(int)
,
Expandable.COORDS_UPDATE
protected boolean expand(int f) throws java.lang.IllegalArgumentException
XSTATE_X
or XSTATE_XC
.
f
- options, only the Expandable.REVERSIBLE_EXPAND
and the Expandable.MDL_EXPAND
flags are taken
into account
java.lang.IllegalArgumentException
- if the group is invisible
(it has a non-expanded parent)setXState(int)
protected boolean contract(int opts) throws java.lang.IllegalArgumentException
XSTATE_C
.
opts
- neglected
java.lang.IllegalArgumentException
- if the group is invisible
(it has a non-expanded parent)setXState(int)
public java.lang.String getSuperscript()
public boolean isOrderedComponentSgroup()
public java.lang.String getSubscript()
public void setSubscript(java.lang.String s)
s
- the subscriptpublic int getType()
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
public int getSubType()
SST_ALTERNATING
,
SST_RANDOM
,
SST_BLOCK
public void setSubType(int t)
t
- the typegetSubType()
public int getConnectivity()
SCN_EITHER_UNKNOWN
,
SCN_HEAD_TO_HEAD
,
SCN_HEAD_TO_TAIL
public void setConnectivity(int c)
c
- the connectivitygetConnectivity()
public boolean hasBrackets()
public final SelectionMolecule cloneStructure()
public Molecule createMolecule()
public Sgroup createMolecule(Molecule m)
m
- the molecule object
public final MolAtom[] getAtomArray()
public final MolAtom getAtom(int i)
i
- the atom index
public final int countAllAtoms()
public final boolean isEmpty()
public final Sgroup cloneSgroup(Molecule m, Sgroup psg)
m
- the new parent moleculepsg
- the new parent S-group
protected Sgroup cloneSgroup(Molecule m, Sgroup psg, int[] atomIndexMap)
m
- the new parent moleculepsg
- the new parent S-groupatomIndexMap
- indices of cloned atoms in the original molecule
or null
public final int getAtomCount()
public int indexOf(MolAtom a)
a
- the atom
public int indexOf(MolBond b)
b
- the bond
public boolean hasAtom(MolAtom a)
a
- the atom
public boolean containsAllAtomsOf(Sgroup sg)
public void add(MolAtom a)
a
- the atompublic void setAtom(int i, MolAtom a)
i
- the indexa
- the atompublic void removeBonds()
public final void removeAtom(MolAtom a)
a
- the atomprotected void removeAtom(MolAtom a, int opts)
a
- the atomopts
- 0 or RA_IN_EXPAND
protected static void removeAtom(Sgroup sg, MolAtom a, int opts)
removeAtom(MolAtom, int)
of
sg. Needed by subclasses because they cannot call the protected
removeAtom(MolAtom, int)
method of another Sgroup.
sg
- the other S-groupa
- the atomopts
- 0 or RA_IN_EXPAND
protected void removeBond(MolBond b)
b
- the bondpublic final void replaceAtom(MolAtom olda, MolAtom newa)
olda
- the original atomnewa
- the new atompublic void replaceAtom(MolAtom olda, MolAtom newa, int opts)
olda
- the original atomnewa
- the new atomopts
- optionsRA_REMOVE_EXCEPT_RU
public MolBond[] findCrossingBonds()
public boolean isBracketCrossingBond(MolBond bond)
public MolAtom[] getCrossingAtoms(MolBond[] xbonds) throws java.lang.IllegalArgumentException
xbonds
- the crossing bonds
java.lang.IllegalArgumentException
- if a bond in the specified
array is not a crossing bondprotected static void removeGroupedAtom(MoleculeGraph m, MolAtom a, MolBond[] v, int opts)
m
- the molecule grapha
- the atomv
- bonds to remove from the atom, remove all bonds if nullopts
- the removal optionsMoleculeGraph.RMCLEANUP_NONE
,
Molecule.RMCLEANUP_SGROUPATOMS
,
Molecule.RMCLEANUP_FROMSGROUPS
,
MoleculeGraph.removeAtom(int, int)
public boolean areChildSgroupsVisible()
public final boolean isVisible()
public boolean isBracketVisible()
true
if visible, false
otherwiseprotected void transformByParent(CTransform3D t, boolean incg)
Molecule.transform(CTransform3D, boolean)
method,
thus only those atom coordinates are transformed here that are not
handled in MoleculeGraph.transform(CTransform3D, boolean)
.
t
- the transformation matrixincg
- graph invariants are changed (true) or not (false)public static void sort(Sgroup[] sgroups, int o)
sgroups
- the array to sorto
- the sort orderSORT_PARENT_CHILD
,
SORT_CHILD_PARENT
public final java.lang.String toString()
@
', and the unsigned
hexadecimal representation of the hash code of the object.
toString
in class java.lang.Object
public java.lang.String toString(int opts)
@
', and the unsigned
hexadecimal representation of the hash code of the object.
opts
- options or 0
PR_ATSYMS
protected static java.lang.String getAtomSymbolListAsString(MolAtom[] atoms)
public boolean isDescendantOf(Sgroup psg)
psg
- the other sgroup
public boolean isRemovable()
ST_MULTIPLE
,
ST_SUPERATOM
public boolean isSelected(MoleculeGraph sel)
sel
- the molecule that contains the selected atoms
public boolean isTotalSelected(MoleculeGraph sel)
sel
- molecule graph that contains the selection
public boolean isPartSelected(MoleculeGraph sel)
sel
- molecule graph that contains the selection
public void clearObjects()
public void removeObject(MObject mo)
mo
- the MObject to remove.public void selectAllObjects(boolean s)
s
- the state value to setpublic void addBracket(MBracket bracket)
bracket
- the bracket to addMBracket
public void initBrackets()
MBracket
public int getBracketCount()
MBracket
public java.util.ArrayList<MBracket> getBrackets()
MBracket
public int getChargeLocation()
CHARGE_ON_ATOMS
or
CHARGE_ON_GROUP
.CHARGE_ON_ATOMS
,
CHARGE_ON_GROUP
public void setChargeLocation(int location)
CHARGE_ON_ATOMS
or
CHARGE_ON_GROUP
.
location
- the charge location type to setCHARGE_ON_ATOMS
,
CHARGE_ON_GROUP
public int getTotalCharge()
MolAtom.getCharge()
public void add(MolBond bond)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |