Class AbstractPosition

java.lang.Object
org.eclipse.scanning.api.points.AbstractPosition
All Implemented Interfaces:
Serializable, IPosition
Direct Known Subclasses:
MapPosition, Point, Scalar, StaticPosition

public abstract class AbstractPosition extends Object implements IPosition, Serializable
See Also:
  • Constructor Details

    • AbstractPosition

      public AbstractPosition()
  • Method Details

    • compound

      public IPosition compound(IPosition parent)
      Description copied from interface: IPosition
      Creates a composite position with the values of this position and the values of the passed in position. The passed in position is assumed to be the parent in the scan.

      NOTE The scan names are not calculated on the call to compound because maintaining the list of names in each dimension is inefficient to calculate for each point (they do not change). Instead the names are created once and set into the position using setDimensionNames(...) available on abstract position.

      Specified by:
      compound in interface IPosition
      Parameters:
      parent -
      Returns:
      the compounded position
    • hashCode

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

      public final boolean equals(Object obj, boolean checkStep)
      Do not override equals. MapPostion("x:1,y:1") should equal Point("x", 1, "y",1) because they represent the same motor values.
      Parameters:
      obj -
      checkStep -
      Returns:
    • equals

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

      public String toString()
      Overrides:
      toString in class Object
    • getDimensionNames

      public List<String> getDimensionNames(int dimension)
    • getDimensionNames

      public List<List<String>> getDimensionNames()
      This method makes dimensionNames if they are null. It must be synchronized because getDimensionNames() is called within the thread pool, for instance when neXus writing positions. Quite a lot of tests were intermittently failing the tests because of this issue. Be careful when creating member data in this class that things are thread safe.
      Specified by:
      getDimensionNames in interface IPosition
      Returns:
      dimensionNames- a List with an entry for each dimension, where each entry is a Set of the axes in that dimension
    • setDimensionNames

      public void setDimensionNames(List<List<String>> dNames)
      Specified by:
      setDimensionNames in interface IPosition
    • getScanRank

      public int getScanRank()
      Description copied from interface: IPosition
      Most scans have rank 1 event though they move more motors line a line scan or a spiral scan. As scans are aggregated these scan dimensions sum together. Some scans start out as having two dimensions like a grid or raster scan.
      Specified by:
      getScanRank in interface IPosition
      Returns:
      scan rank
    • getIndex

      public int getIndex(int dimension)
      Description copied from interface: IPosition
      Get the data index of this point for a given scan dimension. For instance
      Specified by:
      getIndex in interface IPosition
      Parameters:
      dimension -
      Returns:
      data index for the given dimension index
    • getStepIndex

      public int getStepIndex()
      Description copied from interface: IPosition
      The step where the position was in a scan, if it is a position being generated from a scan. If not the value will be -1
      Specified by:
      getStepIndex in interface IPosition
      Returns:
      position in a scan or -1
    • setStepIndex

      public void setStepIndex(int stepIndex)
      Description copied from interface: IPosition
      The step where the position was in a scan, if it is a position being generated from a scan. If not the value will be -1
      Specified by:
      setStepIndex in interface IPosition
      Parameters:
      stepIndex -
    • getExposureTime

      public double getExposureTime()
      Description copied from interface: IPosition
      Get the exposure time to be used for the detector, in seconds. Exposure time is normally set before a 2D scan however for energy scans bands of different energies can be created each with a different step increment and potentially different exposure time. It is not possible to set different detectors with different exposure times during the scan; that would require a map here. Anthony Hull and I decided this should be part of a future change, when required.
      Specified by:
      getExposureTime in interface IPosition
      Returns:
      the exposure time in seconds. Can be zero but not negative. If zero then no change is made to the detector's exposure time setting.
    • setExposureTime

      public void setExposureTime(double exposureTime)
      Description copied from interface: IPosition
      Call to set the exposure time for the position Exposure time is normally set before a 2D scan however for energy scans bands of different energies can be created each with a different step increment and potentially different exposure time. It is not possible to set different detectors with different exposure times during the scan with the mechanism. This can achieved in a malcolm scan by setting IDetectorModel.setExposureTime(double) for each detector in the IMalcolmModel.
      Specified by:
      setExposureTime in interface IPosition
      Parameters:
      exposureTime - exposure time.