chemaxon.struc.sgroup
Class SuperatomSgroup

java.lang.Object
  extended bychemaxon.struc.Sgroup
      extended bychemaxon.struc.sgroup.SuperatomSgroup
All Implemented Interfaces:
Expandable, java.io.Serializable

public class SuperatomSgroup
extends Sgroup
implements Expandable

S-group.

Since:
3.0, 11/05/2002
Version:
3.3, 12/11/2003
Author:
Peter Csizmadia
See Also:
Serialized Form

Field Summary
 
Fields inherited from class chemaxon.struc.Sgroup
SCN_EITHER_UNKNOWN, SCN_HEAD_TO_HEAD, SCN_HEAD_TO_TAIL, sgroupGraph, sgroupType, SST_ALTERNATING, SST_BLOCK, SST_RANDOM, ST_ANY, ST_COPOLYMER, ST_CROSSLINK, ST_DATA, ST_FORMULATION, ST_GENERIC, ST_MER, ST_MIXTURE, ST_MODIFICATION, ST_MONOMER, ST_MULTIPLE, ST_SRU, ST_SUPERATOM
 
Fields inherited from interface chemaxon.struc.sgroup.Expandable
DEFAULT_OPTIONS, MDL_EXPAND
 
Constructor Summary
SuperatomSgroup(Molecule parent, boolean expanded)
          Constructs a superatom S-group.
 
Method Summary
protected  void addAttachAtom(MolAtom a)
          Adds an atom to the list of attachments.
 boolean contract(int opts)
          Contracts this S-group.
protected  void copy(Sgroup sg2, Molecule m)
          Make a copy of this S-group.
 boolean expand(int opts)
          Expands this S-group.
 MolBond[] findCrossingBonds()
          Finds the crossing bonds.
 MolAtom getAttachAtom(int i)
          Gets an attachment point.
 MolAtom[] getCrossingAtoms(MolBond[] xbonds)
          Gets the atoms that have crossing bonds.
 MolAtom[] getFreeLegalAttachAtoms()
          Gets the unused legal attachment points.
 MolAtom[] getLegalAttachAtoms()
          Gets the legal attachment points.
 SelectionMolecule getSgroupGraph()
          Gets the molecule graph as a selection.
 SgroupAtom getSuperAtom()
          Gets the superatom.
 boolean hasBrackets()
          Checks if brackets should be painted or not.
 boolean isContracted()
          Is this S-group contracted?
 boolean isExpanded()
          Is this S-group expanded?
 Sgroup newInstance()
          Gets a new SuperatomSgroup instance.
 void removeAtom(MolAtom a)
          Removes an atom from the S-group.
 void removeBond(MolBond b)
          Removes a bond from the S-group.
 void setAtom(int i, MolAtom a)
          Sets the specified atom in the S-group graph.
 void setSgroupGraph(SelectionMolecule smol)
          Sets the molecule graph.
 MolBond[] updateSgroupCrossings()
          Deprecated. as of Marvin 3.3, replaced by Sgroup.findCrossingBonds()
 
Methods inherited from class chemaxon.struc.Sgroup
add, cloneStructure, countAllAtoms, createMolecule, getAtom, getAtomArray, getAtomCount, getConnectivity, getParentMolecule, getSubscript, getSubType, getSuperscript, getType, indexOf, isEmpty, removeEdges, removeGroupedAtom, setConnectivity, setParentMolecule, setSubscript, setSubType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SuperatomSgroup

public SuperatomSgroup(Molecule parent,
                       boolean expanded)
Constructs a superatom S-group.

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

getSuperAtom

public final SgroupAtom getSuperAtom()
Gets the superatom.

Returns:
the superatom

getAttachAtom

public final MolAtom getAttachAtom(int i)
Gets an attachment point. This method should only be called when the residue is in contracted state.

Parameters:
i - the attachment point index
Returns:
the attachment atom

getSgroupGraph

public SelectionMolecule getSgroupGraph()
Gets the molecule graph as a selection. The nodes are ordered, the first n are the attachment atoms.

Overrides:
getSgroupGraph in class Sgroup
Returns:
the molecule graph
Since:
3.3, 11/04/2003

setSgroupGraph

public void setSgroupGraph(SelectionMolecule smol)
Sets the molecule graph. The first n nodes are supposed to be the attachment points if the S-group is in contracted state.

Overrides:
setSgroupGraph in class Sgroup
Parameters:
smol - the molecule graph
Since:
3.3, 11/04/2003

newInstance

public Sgroup newInstance()
Gets a new SuperatomSgroup instance.

Overrides:
newInstance in class Sgroup
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

public final void removeAtom(MolAtom a)
Removes an atom from the S-group.

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

removeBond

public final void removeBond(MolBond b)
Removes a bond from the S-group.

Overrides:
removeBond in class Sgroup
Parameters:
b - the bond

findCrossingBonds

public MolBond[] findCrossingBonds()
Finds the crossing bonds. Use only when the S-group is expanded.

Overrides:
findCrossingBonds in class Sgroup
Returns:
the attachment bonds
Since:
3.3

getCrossingAtoms

public MolAtom[] getCrossingAtoms(MolBond[] xbonds)
Gets the atoms that have crossing bonds.

Overrides:
getCrossingAtoms in class Sgroup
Parameters:
xbonds - the crossing bonds
Returns:
the attachment atoms
Since:
3.3

copy

protected final void copy(Sgroup sg2,
                          Molecule m)
Make a copy of this S-group.

Overrides:
copy in class Sgroup
Parameters:
sg2 - the target S-group
m - the target molecule or null

hasBrackets

public boolean hasBrackets()
Checks if brackets should be painted or not.

Overrides:
hasBrackets in class Sgroup
Returns:
true if the group is in expanded state
Since:
3.3

expand

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

Specified by:
expand in interface Expandable
Parameters:
opts - expansion options
Returns:
true if the operation was successful, false if already expanded
See Also:
Expandable.DEFAULT_OPTIONS, Expandable.MDL_EXPAND

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
Parameters:
opts - contraction options
Returns:
true if the operation was successful, false if already contracted
See Also:
Expandable.DEFAULT_OPTIONS

isContracted

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

Returns:
true if contracted, false if expanded

getLegalAttachAtoms

public final MolAtom[] getLegalAttachAtoms()
Gets the legal attachment points.

Returns:
array of attachment points

getFreeLegalAttachAtoms

public final MolAtom[] getFreeLegalAttachAtoms()
Gets the unused legal attachment points.

Returns:
array of attachment points

addAttachAtom

protected void addAttachAtom(MolAtom a)
Adds an atom to the list of attachments.

Parameters:
a - the atom

updateSgroupCrossings

public final MolBond[] updateSgroupCrossings()
Deprecated. as of Marvin 3.3, replaced by Sgroup.findCrossingBonds()

Generates the attachment atoms. Use only when the S-group is expanded.

Returns:
the attachment bonds