Class MElectronContainer

java.lang.Object
chemaxon.struc.MObject
chemaxon.struc.graphics.MElectronContainer
All Implemented Interfaces:
Serializable, Cloneable

@PublicApi public class MElectronContainer extends MObject
See Also:
  • Constructor Details

    • MElectronContainer

      public MElectronContainer()
      This constructor is only available for MRVImport
    • MElectronContainer

      public MElectronContainer(MElectron radical)
      Creates a Radical from one MElectron
      Parameters:
      radical - the only MElectron of this container (this argument will be cloned)
    • MElectronContainer

      public MElectronContainer(MElectron lonepairOne, MElectron lonepairTwo)
      Creates a LonePair by the clones of the MElectrons. The order of the MElectrons are important (both in eqality check and others).
    • MElectronContainer

      public MElectronContainer(MElectron lonepairOne, MElectron lonepairTwo, boolean radical)
      Creates a LonePair which can represent radicals or lonepairs by the clones of the MElectrons. The order of the MElectrons are important (both in eqality check and others).
      Parameters:
      radical - if it is true than this lonepair will be a radical
  • Method Details

    • createMElectronContainer

      public static MElectronContainer createMElectronContainer(DPoint3[] coords, MolAtom atom, boolean canBeRadical)
    • addNotify

      public void addNotify(MDocument doc)
      Description copied from class: MObject
      Called when the object is added to a document.
      Overrides:
      addNotify in class MObject
      Parameters:
      doc - The document the object is being added to.
    • removeNotify

      public void removeNotify(MDocument doc)
      Description copied from class: MObject
      Called when the object is removed from a document.
      Overrides:
      removeNotify in class MObject
      Parameters:
      doc - The document from which the object is removed.
    • contains

      public boolean contains(MElectron e)
    • checkValidity

      public boolean checkValidity(MDocument doc, Collection<MolAtom> invec)
      Description copied from class: MObject
      Is it a valid object in the document?
      Overrides:
      checkValidity in class MObject
      Parameters:
      doc - the document
      invec - collection of invalid atoms or null
      Returns:
      true if the object is valid, false if it contains a subobject that is not part of the document
    • getPointCount

      public int getPointCount()
      Description copied from class: MObject
      Gets the number of points.
      Specified by:
      getPointCount in class MObject
      Returns:
      the number of points
    • getPoint

      public MElectron getPoint(int i)
      Description copied from class: MObject
      Gets a point of the object.
      Specified by:
      getPoint in class MObject
      Parameters:
      i - the point index
      Returns:
      the point's clone
    • getPointRefCount

      public int getPointRefCount()
      Description copied from class: MObject
      Gets the number of point references.
      Overrides:
      getPointRefCount in class MObject
      Returns:
      the number of point references.
    • getPointRef

      public MElectron getPointRef(int i, CTransform3D trot)
      Description copied from class: MObject
      Gets a reference to a point of the object.
      Overrides:
      getPointRef in class MObject
      Parameters:
      i - the point index
      trot - the viewing transformation or null
      Returns:
      the point's reference
    • clone

      public MElectronContainer clone()
      Description copied from class: MObject
      Creates a clone.
      Overrides:
      clone in class MObject
      Returns:
      the clone
    • finishCloning

      public void finishCloning(MDocument olddoc, MDocument newdoc)
      Description copied from class: MObject
      Finish cloning a document. Called by the copy constructor.
      Overrides:
      finishCloning in class MObject
    • isInternalSelectable

      public boolean isInternalSelectable()
      Description copied from class: MObject
      Is it a selection only internal object?
      Overrides:
      isInternalSelectable in class MObject
      Returns:
      true if the object is selectable but only exists as part of a real object, false otherwise
    • transform

      public void transform(CTransform3D t, int opts, CTransform3D trot)
      Description copied from class: MObject
      Transforms the object.
      Specified by:
      transform in class MObject
      Parameters:
      t - the transformation matrix
      opts - transform options or 0
      trot - the viewing transformation or null
      See Also:
    • calcCenter

      public void calcCenter(DPoint3 p, CTransform3D t)
      Description copied from class: MObject
      Calculates the geometrical center.
      Specified by:
      calcCenter in class MObject
      Parameters:
      p - store the coordinates here
      t - the transformation matrix or null
    • distanceFrom

      public double distanceFrom(double x, double y, CTransform3D t)
      Description copied from class: MObject
      Gets the 2D distance from the specified point.
      Specified by:
      distanceFrom in class MObject
      Parameters:
      x - the x coordinate
      y - the y coordinate
      t - transformation or null
    • updateBoundingRect

      public void updateBoundingRect(double[] xyminm, CTransform3D pretrf)
      Description copied from class: MObject
      Calculate the bounding rectangle.
      Overrides:
      updateBoundingRect in class MObject
      Parameters:
      xyminm - array containing the current minimum x, y and maximum x, y coordinates
      pretrf - transformation matrix
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getAtom

      public MolAtom getAtom()
      All MElectron should belong to the same MolAtom, this returns the MolAtom reference of the first MElectron.
      Returns:
      the reference of the MolAtom of this container
    • containsAtom

      public boolean containsAtom(MolAtom a)
      Description copied from class: MObject
      Checks if the object contains the specified atom reference.
      Overrides:
      containsAtom in class MObject
      Returns:
      true if the object contains the atom, false otherwise
    • indexOf

      public int indexOf(MElectron e)
    • collectMElectronContainersOfAtom

      public static List<MElectronContainer> collectMElectronContainersOfAtom(MolAtom atom)
      Collects all MElectronContainers of an atom, if the atom is part of a Molecule, which has an MDocument.
      Returns:
      list of MElectronContainers
    • setRadius

      public void setRadius(double d)
      Sets Radius for all MElectrons
    • getRadius

      public double getRadius()
      Returns the radius of MElectrons.
    • isOccupied

      public boolean isOccupied(int index)
      True if the MElectron referenced by the index is occupied.
      Returns:
      true if occupied
    • isFree

      public boolean isFree(int index)
      True if MElectron referenced by the index is not occupied.
      Returns:
      true if free
    • isOccupied

      public boolean isOccupied(MElectron me)
    • isFree

      public boolean isFree(MElectron me)
    • setOccupied

      public void setOccupied(int index)
    • setOccupied

      public void setOccupied(MElectron me)
    • setFree

      public void setFree(int index)
    • setFree

      public void setFree(MElectron me)
    • hasContainerFreeMElectron

      public boolean hasContainerFreeMElectron()
    • getFreeElectronCount

      public int getFreeElectronCount()
    • isContainerFull

      public boolean isContainerFull()
    • isContainerFree

      public boolean isContainerFree()
    • setContainerFree

      public void setContainerFree()
    • setContainerFull

      public void setContainerFull()
    • isLonePairsAsLines

      public boolean isLonePairsAsLines()
    • setLonePairsAsLines

      public void setLonePairsAsLines(boolean lonePairsAsLines)
    • replaceAtom

      public void replaceAtom(MolAtom orig, MolAtom a)
      Description copied from class: MObject
      Replaces a contained atom with another one.
      Overrides:
      replaceAtom in class MObject
      Parameters:
      orig - the original atom
      a - the new atom
    • removeAtom

      public void removeAtom(MolAtom atom)
      Description copied from class: MObject
      Removes the atom from the corresponding molecule object.
      Overrides:
      removeAtom in class MObject
      Parameters:
      atom - the atom to remove
    • setMElectrons

      public void setMElectrons(MElectron[] melectrons)
    • addAttributeKeys

      public void addAttributeKeys(List<String> l)
      Description copied from class: MObject
      Adds the attribute names to the specified list. CDATA attributes are not added.
      Overrides:
      addAttributeKeys in class MObject
      Parameters:
      l - the list
    • getAttribute

      public String getAttribute(String s)
      Description copied from class: MObject
      Gets the value of an attribute.
      Overrides:
      getAttribute in class MObject
      Parameters:
      s - the attribute name
      Returns:
      the value or null
    • setAttribute

      public void setAttribute(String s, String v)
      Description copied from class: MObject
      Sets the value of an attribute.
      Overrides:
      setAttribute in class MObject
      Parameters:
      s - the attribute name
      v - the attribute value
    • ensureValidity

      public void ensureValidity()
    • isRadical

      public boolean isRadical()
    • isLonePair

      public boolean isLonePair()
    • collectLonePairsLikeContainersOfAtom

      public static List<MElectronContainer> collectLonePairsLikeContainersOfAtom(MolAtom atom)
    • collectLonePairContainersOfAtom

      public static List<MElectronContainer> collectLonePairContainersOfAtom(MolAtom atom)
    • collectRadicalContainersOfAtom

      public static List<MElectronContainer> collectRadicalContainersOfAtom(MolAtom atom)
    • collectRadicalsLikeContainersOfAtom

      public static List<MElectronContainer> collectRadicalsLikeContainersOfAtom(MolAtom atom)
    • getClosestMElectronRef

      public MElectron getClosestMElectronRef(DPoint3 atomicCoords)
    • getClosestMElectronRef

      public MElectron getClosestMElectronRef(DPoint3 graphicalCoords, CTransform3D transform)
    • updateDifLoc

      public void updateDifLoc(DPoint3[] dPoint3s)
    • getContainerOfMelectron

      public static MElectronContainer getContainerOfMelectron(MElectron electron)
    • isSelected

      public boolean isSelected()
      Description copied from class: MObject
      Is the object selected?
      Overrides:
      isSelected in class MObject
      Returns:
      true if selected, false otherwise