chemaxon.struc.sgroup
Class MultipleSgroup

java.lang.Object
  extended by chemaxon.struc.Sgroup
      extended by chemaxon.struc.sgroup.MultipleSgroup
All Implemented Interfaces:
Expandable, java.io.Serializable

public class MultipleSgroup
extends Sgroup
implements Expandable

Multiple S-group.

Since:
Marvin 3.3, 08/17/2003
Version:
5.3, 04/27/2009
Author:
Peter Csizmadia
See Also:
Serialized Form

Field Summary
 
Fields inherited from class chemaxon.struc.Sgroup
brackets, CHARGE_ON_ATOMS, CHARGE_ON_GROUP, parentSgroup, PR_ATSYMS, RA_IN_EXPAND, RA_REMOVE_EXCEPT_RU, SCN_EITHER_UNKNOWN, SCN_HEAD_TO_HEAD, SCN_HEAD_TO_TAIL, SGROUP_TYPE_COUNT, sgroupGraph, sgroupType, SORT_CHILD_PARENT, SORT_PARENT_CHILD, SST_ALTERNATING, SST_BLOCK, SST_RANDOM, ST_ANY, ST_COMPONENT, ST_COPOLYMER, ST_CROSSLINK, ST_DATA, ST_FORMULATION, ST_GENERIC, ST_GRAFT, ST_MER, ST_MIXTURE, ST_MODIFICATION, ST_MONOMER, ST_MULTICENTER, ST_MULTIPLE, ST_SRU, ST_SUPERATOM, XSTATE_C, XSTATE_NONE, XSTATE_X, XSTATE_XC
 
Fields inherited from interface chemaxon.struc.sgroup.Expandable
COORDS_UPDATE, DEFAULT_OPTIONS, FAST_COORDS, MDL_EXPAND, NONRECURSIVE_EXPAND, REVERSIBLE_EXPAND
 
Constructor Summary
  MultipleSgroup(Molecule parent, boolean expanded)
          Constructs a multiple S-group.
protected MultipleSgroup(MultipleSgroup sg, Molecule m, Sgroup psg)
          Copy constructor.
 
Method Summary
 void add(MolAtom a)
          Adds a new atom to the S-group.
 void addRepeatingUnitAtom(MolAtom a)
          Adds an atom to the list of paradigmatic repeating unit atoms.
protected  Sgroup cloneSgroup(Molecule m, Sgroup psg, int[] atomIndexMap)
          Gets a new Sgroup instance.
 boolean contract(int opts)
          Contracts this S-group.
 boolean expand(int opts)
          Expands this S-group.
 int getMultiplier()
          Gets the multiplier.
 MolAtom getRepeatingUnitAtom(int i)
          Gets a paradigmatic repeating unit atom.
 int getRepeatingUnitAtomCount()
          Gets the number of atoms in the pararadigmatic repeating unit.
 MolAtom[] getRepeatingUnitAtoms()
          Gets the repeating unit atoms.
 java.lang.String getSubscript()
          Gets the subscript.
static boolean isAcceptableGraph(MoleculeGraph molGraph)
          Decides whether the given molecule graph can be the graph of a multiple s-group.
 boolean isBracketVisible()
          Tests whether the bracket is visible.
 boolean isContracted()
          Is this S-group contracted?
 boolean isExpanded()
          Is this S-group expanded?
 boolean isRepeatingUnitAtom(MolAtom a)
          Checks if the specified atom object is in the paradigmatic repeating unit or not.
 Sgroup newInstance()
          Gets a new MultipleSgroup instance.
protected  void removeAtom(MolAtom a, int opts)
          Removes an atom from the S-group.
 void removeRepeatingUnitAtom(MolAtom a)
          Removes an atom from the list of paradigmatic repeating unit atoms.
 void replaceAtom(MolAtom olda, MolAtom newa, int opts)
          Replace an existing atom by a new one.
 void setAtom(int i, MolAtom a)
          Sets the specified atom in the S-group graph.
 void setMultiplier(int m)
          Sets the multiplier.
 void setRepeatingUnitAtom(MolAtom a, boolean set)
          Adds or removes an atom to/from the list of paradigmatic repeating unit atoms.
 void setSubscript(java.lang.String s)
          Sets the subscript.
 java.lang.String toString(int opts)
          Returns a string representation of the group.
 
Methods inherited from class chemaxon.struc.Sgroup
add, addBracket, addChildSgroup, areChildSgroupsVisible, clearObjects, cloneSgroup, cloneStructure, containsAllAtomsOf, countAllAtoms, createMolecule, createMolecule, findCrossingBonds, findSmallestSgroupContaining, findSmallestSgroupOf, getAtom, getAtomArray, getAtomCount, getAtomSymbolListAsString, getBracketCount, getBrackets, getChargeLocation, getChildSgroup, getChildSgroupCount, getConnectivity, getCrossingAtoms, getParentMolecule, getParentSgroup, getSgroupGraph, getSubType, getSuperscript, getTotalCharge, getType, getXState, hasAtom, hasBrackets, indexOf, indexOf, initBrackets, isBracketCrossingBond, isDescendantOf, isEmpty, isOrderedComponentSgroup, isPartSelected, isRemovable, isSelected, isTotalSelected, isVisible, removeAtom, removeAtom, removeBond, removeBonds, removeChildSgroup, removeGroupedAtom, removeObject, replaceAtom, selectAllObjects, setChargeLocation, setConnectivity, setGUIStateRecursively, setGUIStateRecursively, setParentMolecule, setSgroupGraph, setSubType, setXState, setXState, setXState0, sort, toString, transformByParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MultipleSgroup

public MultipleSgroup(Molecule parent,
                      boolean expanded)
Constructs a multiple S-group.

Parameters:
parent - the parent molecule
expanded - whether the S-group is created in expanded state or not

MultipleSgroup

protected MultipleSgroup(MultipleSgroup sg,
                         Molecule m,
                         Sgroup psg)
Copy constructor.

Parameters:
sg - the S-group to copy
m - the new parent molecule
psg - the new parent S-group or null
Since:
Marvin 3.4
Method Detail

isRepeatingUnitAtom

public final boolean isRepeatingUnitAtom(MolAtom a)
Checks if the specified atom object is in the paradigmatic repeating unit or not.

Parameters:
a - the atom to check
Returns:
true if it is in the paradigmatic repeating unit, false otherwise

isAcceptableGraph

public static boolean isAcceptableGraph(MoleculeGraph molGraph)
Decides whether the given molecule graph can be the graph of a multiple s-group.

Parameters:
molGraph - molecule graph to check
Returns:
true if the graph is acceptable as a multiple sgroup
Since:
Marvin 5.4.0, 01/27/2010

getRepeatingUnitAtomCount

public final int getRepeatingUnitAtomCount()
Gets the number of atoms in the pararadigmatic repeating unit.

Returns:
the number of atoms in the paradigmatic repeating unit

getRepeatingUnitAtom

public final MolAtom getRepeatingUnitAtom(int i)
Gets a paradigmatic repeating unit atom.

Parameters:
i - the paradigmatic repeating unit atom index
Returns:
the paradigmatic repeating unit atom

getRepeatingUnitAtoms

public final MolAtom[] getRepeatingUnitAtoms()
Gets the repeating unit atoms.

Returns:
the paradigmatic repeating unit atoms

addRepeatingUnitAtom

public final void addRepeatingUnitAtom(MolAtom a)
Adds an atom to the list of paradigmatic repeating unit atoms.

Parameters:
a - the atom to add

removeRepeatingUnitAtom

public final void removeRepeatingUnitAtom(MolAtom a)
Removes an atom from the list of paradigmatic repeating unit atoms.

Parameters:
a - the atom to remove

setRepeatingUnitAtom

public final void setRepeatingUnitAtom(MolAtom a,
                                       boolean set)
Adds or removes an atom to/from the list of paradigmatic repeating unit atoms.

Parameters:
a - the atom
set - add (true) or remove (false)

add

public void add(MolAtom a)
Adds a new atom to the S-group.

Overrides:
add in class Sgroup
Parameters:
a - the atom

getMultiplier

public final int getMultiplier()
Gets the multiplier.

Returns:
the multiplier

setMultiplier

public final void setMultiplier(int m)
Sets the multiplier.

Parameters:
m - the multiplier

newInstance

public Sgroup newInstance()
Gets a new MultipleSgroup instance.

Returns:
the new object

setAtom

public final void setAtom(int i,
                          MolAtom a)
Sets the specified atom in the S-group graph.

Overrides:
setAtom in class Sgroup
Parameters:
i - the index
a - the atom

removeAtom

protected final void removeAtom(MolAtom a,
                                int opts)
Removes an atom from the S-group.

Overrides:
removeAtom in class Sgroup
Parameters:
a - the atom
opts - 0 or Sgroup.RA_IN_EXPAND

replaceAtom

public final void replaceAtom(MolAtom olda,
                              MolAtom newa,
                              int opts)
Replace an existing atom by a new one.

Overrides:
replaceAtom in class Sgroup
Parameters:
olda - the original atom
newa - the new atom
opts - options
Since:
4.1, 07/25/2006
See Also:
Sgroup.RA_REMOVE_EXCEPT_RU

cloneSgroup

protected Sgroup cloneSgroup(Molecule m,
                             Sgroup psg,
                             int[] atomIndexMap)
Gets a new Sgroup instance.

Overrides:
cloneSgroup in class Sgroup
Parameters:
m - the new parent molecule
psg - the new parent S-group
atomIndexMap - indices of cloned atoms in the original molecule in the case of partial cloning, or null otherwise
Returns:
the new object
Since:
Marvin 5.0.2, 03/07/2008

setSubscript

public void setSubscript(java.lang.String s)
Sets the subscript.

Overrides:
setSubscript in class Sgroup
Parameters:
s - the multiplier as a string

getSubscript

public java.lang.String getSubscript()
Gets the subscript.

Overrides:
getSubscript in class Sgroup
Returns:
the subscript in contracted state, empty string in expanded state

expand

public final boolean expand(int opts)
Expands this S-group.

Specified by:
expand in interface Expandable
Overrides:
expand in class Sgroup
Parameters:
opts - expansion options
Returns:
true if the operation was successful, false if already expanded
Throws:
java.lang.IllegalArgumentException - if the group is invisible (it has a non-expanded parent)
See Also:
Sgroup.setXState(int)

isExpanded

public final boolean isExpanded()
Is this S-group expanded?

Specified by:
isExpanded in interface Expandable
Returns:
true if expanded, false if contracted

contract

public final boolean contract(int opts)
Contracts this S-group.

Specified by:
contract in interface Expandable
Overrides:
contract in class Sgroup
Parameters:
opts - contraction options
Returns:
true if the operation was successful, false if already contracted
Throws:
java.lang.IllegalArgumentException - if the group is invisible (it has a non-expanded parent)
See Also:
Sgroup.setXState(int)

isContracted

public final boolean isContracted()
Is this S-group contracted?

Returns:
true if contracted, false if expanded

isBracketVisible

public boolean isBracketVisible()
Tests whether the bracket is visible. Multiple S-group brackets are only visible in expanded state.

Overrides:
isBracketVisible in class Sgroup
Returns:
true in contracted, false in expanded state
Since:
Marvin 3.5.1, 11/12/2004

toString

public java.lang.String toString(int opts)
Returns a string representation of the group.

Overrides:
toString in class Sgroup
Parameters:
opts - options or 0
Returns:
the string representation
Since:
Marvin 4.1, 07/26/2006
See Also:
Sgroup.PR_ATSYMS