Class SuperatomSgroup

java.lang.Object
chemaxon.struc.Sgroup
chemaxon.struc.sgroup.SuperatomSgroup
All Implemented Interfaces:
chemaxon.core.structure.AbbreviationForBuilder<Integer>, chemaxon.core.structure.MoleculeForBuilder, chemaxon.core.structure.RootStructureForBuilder, chemaxon.core.structure.StructureForBuilder, Expandable, Serializable

@PublicAPI public class SuperatomSgroup extends Sgroup implements Expandable, chemaxon.core.structure.AbbreviationForBuilder<Integer>
Superatom S-group.
Since:
Marvin 3.0, 11/05/2002
See Also:
  • Constructor Details

    • SuperatomSgroup

      public SuperatomSgroup(Molecule parent)
      Constructs a superatom S-group in expanded state. Its superatom is automatically created.
      Parameters:
      parent - the parent molecule
      Since:
      Marvin 3.5.3, 01/18/2005
      See Also:
    • SuperatomSgroup

      public SuperatomSgroup(Molecule parent, boolean expanded)
      Constructs a superatom S-group. Its superatom is automatically created. Please note the S-group is not added automatically to the parent molecule.
      Parameters:
      parent - the parent molecule
      expanded - whether the S-group is created in expanded state or not
      See Also:
    • SuperatomSgroup

      protected SuperatomSgroup(SuperatomSgroup sg, Molecule m, Sgroup psg, int[] atomIndexMap)
      Copy constructor.
      Parameters:
      sg - the S-group to copy
      m - the new parent molecule
      psg - the new parent S-group or null
      atomIndexMap - indices of cloned atoms in the original molecule or null
      Since:
      Marvin 5.0.2, 03/07/2008
  • Method Details

    • getSuperAtom

      public final SgroupAtom getSuperAtom()
      Gets the superatom.
      Returns:
      the superatom
    • getAttachAtoms

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public final MolAtom[] getAttachAtoms()
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 6.0, replaced by getBoundAttachAtoms().
      Gets atoms with attachment point having crossing bond. This method should only be called when the residue is in contracted state.
      Returns:
      the attachment atoms
      Since:
      Marvin 4.0.4, 01/09/2006
    • getBoundAttachAtoms

      public final MolAtom[] getBoundAttachAtoms()
      Gets atoms with attachment point having crossing bond. This method should only be called when the residue is in contracted state.
      Returns:
      the attachment atoms having crossing bond
      Since:
      Marvin 6.0, Dec 11, 2012
    • getFreeLegalAttachAtoms

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public final MolAtom[] getFreeLegalAttachAtoms()
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 6.0, replaced by getFreeAttachAtoms().
      Gets the atoms with free attachment points. Free if the corresponding attachment point is free.
      Returns:
      array of MolAtoms having free attachment point.
      See Also:
      • AttachmentPoint.isFree()
    • getFreeAttachAtoms

      public final MolAtom[] getFreeAttachAtoms()
      Gets the atoms with free attachment points. Free if the corresponding attachment point is free.
      Returns:
      array of MolAtoms having free attachment point.
      Since:
      Marvin 6.0, Dec 11, 2012
      See Also:
      • AttachmentPoint.isFree()
    • isFreeLegalAttachAtom

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public final boolean isFreeLegalAttachAtom(MolAtom a)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 6.0, replaced by isFreeAttachAtom(MolAtom a).
      Tests whether the specified atom has a free attachment point.
      Parameters:
      a - the atom
      Returns:
      true if it has free attachment point, false otherwise
      Since:
      5.0, 09/23/2007
    • isFreeAttachAtom

      public final boolean isFreeAttachAtom(MolAtom a)
      Checks whether the specified atom has free attachment point.
      Parameters:
      a - the atom
      Returns:
      true if it has free attachment point, false otherwise
      Since:
      Marvin 6.0, Dec 11, 2012
      See Also:
    • getLegalAttachAtoms

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public final MolAtom[] getLegalAttachAtoms()
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 6.0, replaced by getAllAttachAtoms().
      Gets all attachment atoms (from free and bound attachment points).
      Returns:
      array of attachment atoms
    • getAllAttachAtoms

      public final MolAtom[] getAllAttachAtoms()
      Gets the attachment atoms (atoms having attachment point).
      Returns:
      array of attach atoms
      Since:
      Marvin 6.0, Dec 11, 2012
    • isLegalAttachment

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public final boolean isLegalAttachment(MolAtom atom)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 6.0, replaced by isAttachmentAtom(MolAtom).
      Checks whether the given atom is an attachment atom or not.
      Parameters:
      atom - the atom
      Returns:
      true if the given atom is an attachment atom false otherwise
      Since:
      3.5, 11/04/2004
    • isAttachmentAtom

      public final boolean isAttachmentAtom(MolAtom a)
      Checks whether the given atom is an attachment atom or not.
      Parameters:
      a - the atom
      Returns:
      true if the given atom is an attachment atom false otherwise
      Since:
      Marvin 6.0, Dec 11, 2012
      See Also:
    • updateAttachmentPoints

      @Deprecated public void updateAttachmentPoints()
      Deprecated.
      as of Marvin 6.2, use calculateAttachmentPoints() instead
      Adjusts attachment point information to current bonding.
      Throws:
      chemaxon.struc.sgroup.NoFreeAttachmentPointException - if there are not enough free attachment point
    • 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:
      Marvin 3.3, 11/04/2003
    • getParentSgroupGraph

      @Deprecated public SelectionMolecule getParentSgroupGraph()
      Deprecated.
      as of Marvin 6.2, intended for internal use, similar functionality can be reached by getSgroupGraph()
      Gets the parent exact sgroupgraph. Internal use only.
      Returns:
      the sgroupGraph
    • setSgroupGraph

      public void setSgroupGraph(SelectionMolecule smol)
      Sets the molecule graph. If the S-group is in contracted state then:
      • In case of single attachment points the first n nodes are supposed to be the attachment points.
      • In case of double attachment point the graph is searched for the attachment point.
      Overrides:
      setSgroupGraph in class Sgroup
      Parameters:
      smol - the molecule graph
      Since:
      Marvin 3.3, 11/04/2003
    • 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 or null
      Returns:
      the new object
      Since:
      5.0.2, 03/07/2008
    • 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 atom, int opts)
      Removes an atom from the S-group.
      Overrides:
      removeAtom in class Sgroup
      Parameters:
      atom - the atom
      opts - unused argument
    • removeBond

      public final void removeBond(MolBond bond)
      Removes a the given bond from the S-group.
      Overrides:
      removeBond in class Sgroup
      Parameters:
      bond - 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:
      Marvin 3.3
    • getCrossingAtoms

      public MolAtom[] getCrossingAtoms(MolBond[] xbonds)
      Gets the atoms from the S-group that have crossing bonds.
      Overrides:
      getCrossingAtoms in class Sgroup
      Parameters:
      xbonds - the crossing bonds
      Returns:
      the attachment atoms
      Since:
      Marvin 3.3
      See Also:
    • findAttachAtom

      public MolAtom findAttachAtom()
      Gets the attachment atom of attachment point with the smallest order.
      Returns:
      the attachment point with the smallest order or null if there is not any attachment point
      Since:
      Marvin 4.1, 03/08/2006
    • transformByParent

      protected void transformByParent(CTransform3D t, boolean incg)
      Applies a transformation matrix to the Sgroup coordinates. (Only absolute placement.) This method is called by the parent molecule's Molecule.transform(CTransform3D, boolean) method, thus only those atom coordinates are transformed here that are not handled in MoleculeGraph.transform(CTransform3D, boolean).
      Overrides:
      transformByParent in class Sgroup
      Parameters:
      t - the transformation matrix
      incg - graph invariants are changed (true) or not (false)
      Since:
      Marvin 5.0, 08/18/2007
    • 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:
      Marvin 3.3
    • hasAtom

      public boolean hasAtom(MolAtom a)
      Is the specified atom an element of this group?
      Overrides:
      hasAtom in class Sgroup
      Parameters:
      a - the atom
      Returns:
      true if it contains the atom, false otherwise
      Since:
      Marvin 3.4
    • expand

      public final boolean expand(int opts) throws IllegalArgumentException
      Expands this S-group. Atom indexes are preserved during expansion. During the expand, the atoms of the superatom s-group get into MoleculeGraph.
      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:
      IllegalArgumentException - if the group is invisible (it has a non-expanded parent)
      See Also:
    • expandOther

      @Deprecated public final boolean expandOther(int opts, Molecule moltoexpand) throws IllegalArgumentException
      Deprecated.
      as of Marvin 6.2. use expand(int) instead on the s-groups desired to be expanded
      Expands other S-group the same way as it would be this. The other Sgroup is the first S-group of the other molecule (moltoexpand). Atom indices are preserved during expansion.
      Parameters:
      opts - expansion options
      moltoexpand - molecule containing an Sgroup that has to be expanded
      Returns:
      true if the operation was successful, false if already expanded
      Throws:
      IllegalArgumentException - if the group is invisible (it has a non-expanded parent)
    • 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) throws IllegalArgumentException
      Contracts this S-group. During the contraction, atoms of this superatom s-group vanish from the molecule graph and substituted with one superatom.
      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:
      IllegalArgumentException - if the group is invisible (it has a non-expanded parent)
      See Also:
    • calculateCoordinates

      protected void calculateCoordinates(Molecule parentMol, MolBond[] xbonds, MoleculeGraph g, int opts, boolean isContract, SelectionMolecule otherSgroup, List<Double> xBondLength)
      Calculates the coordinates during expand and contract.
      Parameters:
      parentMol - the parent molecule of the superatomSgroup
      xbonds - array of the crossing bonds
      g - graph of the sgroup
      opts - expand option
      isContract - true if it is called from contract, false if do so from expand
      otherSgroup - graph of the other sgroup in expandOther
      Since:
      Marvin 6.2, Aug 8, 2013
    • isContracted

      public final boolean isContracted()
      Decides whether this S-group is contracted or not.
      Returns:
      true if contracted false otherwise
    • isBracketVisible

      public boolean isBracketVisible()
      Tests whether the bracket is visible.
      Overrides:
      isBracketVisible in class Sgroup
      Returns:
      false, superatom S-group brackets are not visible
      Since:
      Marvin 3.5.1, 11/12/2004
    • isTotalSelected

      public boolean isTotalSelected(MoleculeGraph sel)
      Decides if the whole superatom sgroup is selected or not. Overrides method in parent class.
      Overrides:
      isTotalSelected in class Sgroup
      Parameters:
      sel - molecule graph that contains the selection
      Returns:
      true if the whole superatom group is selected
    • areChildSgroupsVisible

      public boolean areChildSgroupsVisible()
      Checks whether the child S-groups are visible.
      Overrides:
      areChildSgroupsVisible in class Sgroup
      Returns:
      true if children are visible, false otherwise
      Since:
      Marvin 3.4
    • sortXBonds

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public void sortXBonds()
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 5.12, no replacement.
      Crossing bonds of a SuperatomSgroup do not need to be sorted any more. It is not advised to sort them anyway because then the indexes of bonds change in the parent molecule.
      Sorts the crossing bonds in the parent molecule in attachment point number order.
      Since:
      Marvin 5.0, 12/07/2007
    • getExternalConnections

      public int getExternalConnections(MolAtom a)
      Gets the number of bonds of a specified atom where the neighbor atom doesn't belong to the S-group.
      Parameters:
      a - the atom whose connections to be checked
      Returns:
      the number of external connection or 0 if the specified atom doesn't belong to the S-group.
    • createMolecule

      public Molecule createMolecule()
      Creates a molecule object that contains only one SuperatomSgroup identical to this one.
      Overrides:
      createMolecule in class Sgroup
      Returns:
      the molecule containing one SuperatomSgroup
      Since:
      Marvin 3.4
    • createGroup

      protected SuperatomSgroup createGroup()
    • replaceAtom

      public final void replaceAtom(MolAtom oldAtom, MolAtom newAtom, int opts)
      Replace an existing atom by a new one.
      Overrides:
      replaceAtom in class Sgroup
      Parameters:
      oldAtom - the original atom
      newAtom - the new atom
      opts - options
      Since:
      4.1, 07/25/2006
      See Also:
    • toString

      public 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:
    • setGUIStateRecursively

      @Deprecated public final boolean setGUIStateRecursively(boolean v) throws IllegalArgumentException
      Deprecated.
      Sets the expanded/contracted state recursively.
      Overrides:
      setGUIStateRecursively in class Sgroup
      Parameters:
      v - true sets Sgroup.XSTATE_C if previous state was Sgroup.XSTATE_XC, false sets Sgroup.XSTATE_XC if previous state was Sgroup.XSTATE_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 5.1
      See Also:
    • calculateAttachmentPoints

      public void calculateAttachmentPoints()
      Calculates the attachment points for the crossing atoms and crossing bonds and sets the calculated values.
      1. The properly set crossing bond are kept
      2. Those attachment points that's bond is not-crossing bond will be removed
      3. For those crossing bonds that have no attachment point connected will be calculated one from the free ones or will be given a new one
    • hasOrder

      public boolean hasOrder(int order)
    • removeAttachmentPoints

      public void removeAttachmentPoints(MolAtom atom)
      Removes all attachment points of the given attachment atom.
      Parameters:
      atom - the attachment atom
      Throws:
      IllegalArgumentException - if the given atom is not part of the superatom s-group
    • setAttachmentPointOrder

      public void setAttachmentPointOrder(MolAtom atom, int oldOrder, int newOrder)
      Sets a new order for the given attachment point. The order must be a positive number.
      Parameters:
      atom - the attachment atom of the attachment point
      oldOrder - the old attachment order of the attachment point
      newOrder - the new attachment order of the attachment point
      Throws:
      IllegalArgumentException - if the given atom is not part of the superatom S-group or the given new order is negativ or zero
      Since:
      Marvin 6.0, Dec 5, 2012
    • getAttachmentPointOrders

      public List<Integer> getAttachmentPointOrders(MolAtom atom)
      Gets the attachment orders of the given attachment atom.
      Parameters:
      atom - the attachment atom
      Returns:
      the list of the attachment orders
      Since:
      Marvin 6.0, Dec 5, 2012
    • getFreeAttachmentPointOrders

      public List<Integer> getFreeAttachmentPointOrders(MolAtom atom)
      Gets the sorted free attachment orders of the given attachment atom.
      Parameters:
      atom - the attachment atom
      Returns:
      the sorted list of the free attachment orders
      Since:
      Marvin 6.0, Dec 5, 2012
      See Also:
      • AttachmentPoint.isFree()
    • add

      public void add(MolAtom atom)
      Adds a new atom to the S-group.
      Overrides:
      add in class Sgroup
      Parameters:
      atom - the atom
      Since:
      Marvin 6.0 Dec 5, 2012.
    • getAttachmentPointCount

      public int getAttachmentPointCount()
      Gets the number of the attachment points.
      Specified by:
      getAttachmentPointCount in interface chemaxon.core.structure.AbbreviationForBuilder<Integer>
      Returns:
      the number of the attachment points
      Since:
      Marvin 6.0, Dec 4, 2012
    • 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. If the newly added bond was crossing bond then the attachment point connected to this bond will be removed.
      Overrides:
      checkBonds in class Sgroup
      Parameters:
      atom - the atom
    • getAttachmentPoints

      public List<chemaxon.struc.sgroup.AttachmentPoint> getAttachmentPoints()
      Gets the sorted copy of the attachment point list.
      Returns:
      the list of the attachment points
      Since:
      Marvin 6.0, Dec 5, 2012
    • setCrossingBond

      public void setCrossingBond(int order, MolBond bond)
      Change the crossing bond of an attachment point.
      Parameters:
      order - the order of the attachment point
      bond - the crossing bond to be set
      Throws:
      IllegalArgumentException -
    • if no attachment point exists with the given order
    • if the attachment atom for the given order is not the same as the original attachment atom in expanded state
    • if the given bond is not a crossing bond for this superatom s-group
    • IllegalStateException
      chemaxon.struc.sgroup.NoFreeAttachmentPointException - if the attachment point for the given order is not free
    • addAttachmentPoint

      public int addAttachmentPoint(MolAtom atom)
      Adds a new free attachment point for an atom. The order will be the smallest non used order.
      Parameters:
      atom - the attachment atom of the new attachment point
      Returns:
      the attachment order of the new attachment point
      Throws:
      IllegalArgumentException - if the given atom is not part of the superatom S-group
      Since:
      Marvin 6.0, Dec 5, 2012
    • addAttachmentPoint

      public int addAttachmentPoint(MolAtom atom, int order)
      Adds a new free attachment point of the given attachment atom and order. The order must be a positive number.
      Parameters:
      atom - the attachment atom of the new attachment point
      order - the attachment order of the new attachment point
      Returns:
      the attachment order of the new attachment point
      Throws:
      IllegalArgumentException - if the order is a non positive number
      Since:
      Marvin 6.0, Dec 5, 2012
    • addAttachmentPoint

      public int addAttachmentPoint(MolAtom atom, int order, MolBond bond)
      Adds a new free attachment point.
      Parameters:
      atom - the attachment atom of the new attachment point
      bond - the crossing bond of the new attachment point
      order - the attachment order of the new attachment point
      Returns:
      the attachment order of the new attachment point
      Throws:
      IllegalArgumentException - if the given atom is not part of the superatom S-group
      Since:
      Marvin 6.0, Dec 5, 2012
    • removeAllAttachmentPoints

      public void removeAllAttachmentPoints()
      Removes all attachment points of the Superatom s-group.
      Since:
      Marvin 6.0, Dec 17, 2012
    • removeAttachmentPoint

      public void removeAttachmentPoint(int order)
      Removes the attachment point with the given order.
      Parameters:
      order - the order which's attachment point will be removed
    • getFreeAttachmentPointOrders

      public List<Integer> getFreeAttachmentPointOrders()
      Gets the increasingly sorted orders of the free attachment points.
      Returns:
      the list of the increasingly sorted orders of the free attachment points
    • getAttachmentPoint

      public chemaxon.struc.sgroup.AttachmentPoint getAttachmentPoint(int order)
      Gets the attachment point that's order is given as parameter
      Parameters:
      order - the required attachment point's order
      Returns:
      the attachment point that's order equals to the parameter
    • getFreeAttachmentPointCount

      public int getFreeAttachmentPointCount()
      Gets the number of free attachment points.
      Returns:
      the number of free attachment points.
    • clone

      public SuperatomSgroup clone()
      Clones the SuperatomSgroup (and not the Molecule).
      Overrides:
      clone in class Object
      Returns:
      the cloned superatom s-group
      Since:
      Marvin 6.0, 2013.02.21.
    • getAttachmentPointOrders

      public List<Integer> getAttachmentPointOrders()
      Gets the orders with which attachment point exists
      Returns:
      the list of the orders of the attachment points
    • checkSgroupGraphConsistency

      protected boolean checkSgroupGraphConsistency(Sgroup parent)
      Checks whether the parameter s-group contain the proper atoms of this SuperatomSgroup. That means the SgroupAtom of this s-group if it is contracted state or all of it's atoms if it is in expanded state.
      Overrides:
      checkSgroupGraphConsistency in class Sgroup
      Parameters:
      parent - parent of Sgroup
      Returns:
      true if the s-group is consistent
    • clearSavedAtomIndices

      public void clearSavedAtomIndices()