Class MEFlow

All Implemented Interfaces:
Serializable, Cloneable

@PublicApi public class MEFlow extends MPolyline
Electron flow arrow.
Representing the movement of one or two electrons in a reaction as a curved arrow.
Electron flow can start from any atom or bond, but not from any atom pairs that has no connection bond.
The logic of the electron flows:
  • If the source is an Atom, the sink can be:
    • any Atom
    • Bond connected to this Atom
    • an atom pair from this atom and any other atom (incipient bond)
  • If the source is a Bond, the sink can be:
    • one of the Atoms on the end of this Bond
    • a Bond connected to this Bond (has common ending Atom)
    • an atom pair from one of the Atoms on the end of this Bond and any other atom (incipient bond)
  • If only the sink/source is in an sgroup, the sink/source must be the attachment point.
Since:
Marvin 3.5, 07/14/2004
See Also:
  • Field Details

  • Constructor Details

    • MEFlow

      public MEFlow()
      Contructs an empty 2 electron flow arrow.
    • MEFlow

      public MEFlow(int ne)
      Contructs an empty electron flow arrow.
      Parameters:
      ne - one-electron (1) or two-electron (2) transfer
    • MEFlow

      public MEFlow(MPoint p1, MPoint p2, int ne)
      Contructs an electron flow arrow with the specified endpoints.
      Parameters:
      p1 - the starting point
      p2 - the endpoint
      ne - one-electron (1) or two-electron (2) transfer
      See Also:
    • MEFlow

      protected MEFlow(MEFlow l)
      Copy constructor.
      Parameters:
      l - the original arrow
  • Method Details

    • getNumElectrons

      public int getNumElectrons()
      Gets the number of electrons the arrow represents.
      Returns:
      1 or 2
    • getPoint

      public MPoint getPoint(int i)
      Gets a point of the line.
      Overrides:
      getPoint in class MPolyline
      Parameters:
      i - the point index
      Returns:
      the point's clone
    • clone

      public MEFlow clone()
      Description copied from class: MObject
      Creates a clone.
      Overrides:
      clone in class MPolyline
      Returns:
      the clone
    • getMolObject

      public Object getMolObject(int i)
      Gets the electron source or sink.
      Parameters:
      i - E_SOURCE or E_SINK
      Returns:
      a MolAtom, MolBond or MolAtom[2] (incipient bond) object
    • getPointRefCount

      public int getPointRefCount()
      Gets the number of point references.
      Overrides:
      getPointRefCount in class MPolyline
      Returns:
      2 because middle point is not needed
    • getSource

      public Object getSource()
      Gets the origin of the electron-flow arrow (MolAtom or MolBond).
      Returns:
      origin of the electron-flow arrow
    • getSink

      public Object getSink()
      Gets the destination of the electron-flow arrow (MolAtom, MolBond, or MolAtom[2] for incipient bond).
      Returns:
      destination of the electron-flow arrow
    • sourceIsAtom

      public boolean sourceIsAtom()
      Gets whether this arrow's source is an atom.
      Returns:
      whether this arrow's source is an atom
    • sinkIsAtom

      public boolean sinkIsAtom()
      Gets whether this arrow's sink is an atom.
      Returns:
      whether this arrow's sink is an atom
    • isAtom

      public static boolean isAtom(Object terminus)
      Gets whether the arrow's terminus is at an atom.
      Parameters:
      terminus - the arrow terminus
      Returns:
      whether the arrow's terminus is at an atom
    • sourceIsBond

      public boolean sourceIsBond()
      Gets whether this arrow's source is a bond.
      Returns:
      whether this arrow's source is a bond
    • sinkIsBond

      public boolean sinkIsBond()
      Gets whether this arrow's sink is a bond.
      Returns:
      whether this arrow's sink is a bond
    • isBond

      public static boolean isBond(Object terminus)
      Gets whether the arrow's terminus is at a bond.
      Parameters:
      terminus - the arrow terminus
      Returns:
      whether the arrow's terminus is at a bond
    • sinkIsIncipBond

      public boolean sinkIsIncipBond()
      Gets whether this arrow's sink is an incipient bond.
      Returns:
      whether this arrow's sink is an incipient bond
    • isIncipBond

      public static boolean isIncipBond(Object sink)
      Gets whether the arrow's sink is at an incipient bond.
      Parameters:
      sink - the arrow sink
      Returns:
      whether the arrow's sink is at an incipient bond
    • getSourceAtom

      public MolAtom getSourceAtom()
      Gets the atom at the source of this arrow. Use only after sourceIsAtom().
      Returns:
      the atom at the source of this arrow
    • getSinkAtom

      public MolAtom getSinkAtom()
      Gets the atom at the sink of this arrow. Use only after sinkIsAtom().
      Returns:
      the atom at the sink of this arrow
    • getAtom

      public static MolAtom getAtom(Object terminus)
      Gets the atom at the terminus of an arrow.
      Parameters:
      terminus - the arrow terminus
      Returns:
      the atom at the terminus of an arrow or null if it is not a MolAtom.
    • getBond

      public static MolBond getBond(Object terminus)
      Gets the bond at the terminus of an arrow.
      Parameters:
      terminus - the arrow terminus
      Returns:
      the bond at the terminus of an arrow or null if the terminus is not a MolBond.
    • getSourceBond

      public MolBond getSourceBond()
      Gets the bond at the source of this arrow. Use only after sourceIsBond().
      Returns:
      the bond at the source of this arrow
    • getSinkBond

      public MolBond getSinkBond()
      Gets the bond at the sink of this arrow. Use only after sinkIsBond().
      Returns:
      the bond at the sink of this arrow
    • getSourceAtoms

      public MolAtom[] getSourceAtoms()
      Gets the atom or atoms at the arrow source.
      Returns:
      the atom or atoms at the arrow source
    • getSinkAtoms

      public MolAtom[] getSinkAtoms()
      Gets the atom or atoms at the arrow sink.
      Returns:
      the atom or atoms at the arrow sink
    • getAtoms

      public static MolAtom[] getAtoms(Object terminus)
      Gets the atom or atoms at the terminus of an arrow.
      Parameters:
      terminus - the arrow terminus
      Returns:
      the atom or atoms at the terminus of an arrow
    • getEFlowsOfAtom

      public static List<MEFlow> getEFlowsOfAtom(MolAtom atom)
      Returns all the EFlows that are started from this atom or pointing to this atom.
      Parameters:
      atom - the sink or source atom
      Returns:
      List of EFlows, empty if no EFlow starts from this atom and no EFlow ends to this atom.
    • getEFlowsFromAtom

      public static List<MEFlow> getEFlowsFromAtom(MolAtom atom)
      Returns all the EFlow from this atom. See getEFlowsOfAtom(MolAtom).
      Returns:
      List of MEFlows, empty if no electron flow arrow is connected to the atom.
    • getEFlowsToAtom

      public static List<MEFlow> getEFlowsToAtom(MolAtom atom)
      Returns all the EFlows to this atom. See getEFlowsOfAtom(MolAtom).
      Returns:
      List of MEFlows, empty if no electron flow arrow is connected to the atom.
    • setSkipsToEndPoints

      public void setSkipsToEndPoints()
    • setBaseElectronContainer

      public void setBaseElectronContainer(MolAtom atom, MDocument doc)
    • resetBaseElectronContainer

      public void resetBaseElectronContainer(MolAtom atom, MDocument doc)
    • getBaseElectronContainerIndex

      public int getBaseElectronContainerIndex()
    • setBaseElectronContainerIndex

      public void setBaseElectronContainerIndex(int idx)
    • getBaseElectronIndexInContainer

      public int getBaseElectronIndexInContainer()
    • setBaseElectronIndexInContainer

      public void setBaseElectronIndexInContainer(int idx)
    • getValidSourceAtomsForMolecule

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public static MolAtom[] getValidSourceAtomsForMolecule(Molecule m)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 6.1, replaced by EFlowPlacementValidators.getValidSourceAtoms(Molecule) .
    • getValidSourceBondsForMolecule

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public static MolBond[] getValidSourceBondsForMolecule(Molecule m)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 6.1, replaced by EFlowPlacementValidators.getValidSourceBonds(Molecule) .
    • getValidSourceAtomPairsForMolecule

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public static MolAtom[][] getValidSourceAtomPairsForMolecule(Molecule m)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 6.1, replaced by EFlowPlacementValidators.getValidSourceAtomPairs(Molecule) .
    • getValidSinkAtomsForMolecule

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public static MolAtom[] getValidSinkAtomsForMolecule(Molecule m, MolAtom source)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 6.1, replaced by EFlowPlacementValidators.getValidSinkAtoms(Molecule, MolAtom) .
    • getValidSinkAtomsForMolecule

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public static MolAtom[] getValidSinkAtomsForMolecule(Molecule m, MolBond source)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 6.1, replaced by EFlowPlacementValidators.getValidSinkAtoms(Molecule, MolBond) .
    • getValidSinkBondsForMolecule

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public static MolBond[] getValidSinkBondsForMolecule(Molecule m, MolAtom source)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 6.1, replaced by EFlowPlacementValidators.getValidSinkBonds(Molecule, MolAtom) .
    • getValidSinkBondsForMolecule

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public static MolBond[] getValidSinkBondsForMolecule(Molecule m, MolBond source)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 6.1, replaced by EFlowPlacementValidators.getValidSinkBonds(Molecule, MolBond) .
    • getValidSinkAtomPairsForMolecule

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public static MolAtom[][] getValidSinkAtomPairsForMolecule(Molecule m, MolAtom source)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 6.1, replaced by EFlowPlacementValidators.getValidSinkAtomPairs(Molecule, MolAtom) .
    • getValidSinkAtomPairsForMolecule

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public static MolAtom[][] getValidSinkAtomPairsForMolecule(Molecule m, MolBond source)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 6.1, replaced by EFlowPlacementValidators.getValidSinkAtomPairs(Molecule, MolBond) .
    • isValidSourceForMolecule

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public static boolean isValidSourceForMolecule(Object source, Molecule m)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 6.1, replaced by EFlowPlacementValidators.isValidSource(MolAtom, Molecule) or EFlowPlacementValidators.isValidSource(MolAtom[], Molecule) or EFlowPlacementValidators.isValidSource(MolBond, Molecule) .
    • isValidSourceAndSinkForMolecule

      @Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public static boolean isValidSourceAndSinkForMolecule(Object source, Object sink, Molecule m)
      Deprecated, for removal: This API element is subject to removal in a future version.
      As of Marvin 6.1, replaced by EFlowPlacementValidators.isValidFlow(MolAtom, MolAtom, Molecule) or one of the other implementations instead.
    • distanceFrom

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

      public void copyProperties(MPolyline l)
      Description copied from class: MPolyline
      Copies line properties to another line object.
      Overrides:
      copyProperties in class MPolyline
      Parameters:
      l - the other line
    • getAttribute

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

      public void addAttributeKeys(List<String> v)
      Description copied from class: MPolyline
      Adds the attribute names to the specified vector.
      Overrides:
      addAttributeKeys in class MPolyline
      Parameters:
      v - the vector
    • setAttribute

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

      public MElectron getMElectron()
    • getMElectronRef

      public MElectron getMElectronRef()
    • getMElectronContainer

      public MElectronContainer getMElectronContainer()
    • releaseBaseMElectrons

      public void releaseBaseMElectrons()
    • 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
    • removeNotify

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