Class EnumPositionerBase

All Implemented Interfaces:
Device, EnumPositioner, Scannable, Configurable, Findable, gda.observable.IObservable
Direct Known Subclasses:
DummyValve, EditableEnumPositionerBase, EpicsAirBearingControl, EpicsCurrAmpQuadController, EpicsEnumPositioner, EpicsLimitBasedPositioner, EpicsPneumaticCallback, EpicsPositioner, EpicsQbpm, EpicsSimpleBinary, EpicsSimpleMbbinary, EpicsSimplePneumatic, EpicsSimplePositioner, EpicsValve, MapperBasedEnumPositionerBase, ME2Positioner, SamplePlateEnumPositioner, TfgChannelEnum, ZebraShutterPositioner

public abstract class EnumPositionerBase extends ScannableBase implements EnumPositioner
Base class for the EnumPositioner interface
  • Constructor Details

    • EnumPositionerBase

      public EnumPositionerBase()
      sets the OutputFormat
  • Method Details

    • getPositions

      public String[] getPositions() throws DeviceException
      Description copied from interface: EnumPositioner
      Returns an array of the positions which this device can be moved to.
      Specified by:
      getPositions in interface EnumPositioner
      Returns:
      an array of positions
      Throws:
      DeviceException
    • getPositionsList

      public List<String> getPositionsList()
      Description copied from interface: EnumPositioner
      Returns a list of the positions which this device can be moved to.
      Specified by:
      getPositionsList in interface EnumPositioner
      Returns:
      a list of positions
    • getPosition

      protected String getPosition(int index)
    • containsPosition

      protected boolean containsPosition(String position)
    • getPositionIndex

      protected int getPositionIndex(String position)
    • getNumberOfPositions

      protected int getNumberOfPositions()
    • clearPositions

      protected void clearPositions()
    • setPositionsInternal

      protected void setPositionsInternal(Collection<String> positions)
    • addPosition

      protected void addPosition(String position)
    • addPositions

      protected void addPositions(Collection<String> positions)
    • setPositionerStatus

      public void setPositionerStatus(EnumPositionerStatus positionerStatus)
      Set the positioner status

      Ideally, this function should be protected, but this causes runtime exceptions because of the interaction of three factors:

      • Some of this class's subclasses reside in a different plugin (uk.ac.gda.epics)
      • The run-time package of a class or interface is determined by the package name AND its class loader (see https://docs.oracle.com/javase/specs/jvms/se11/html/jvms-5.html#jvms-5.3-300)
      • In OSGi each plugin has a different class loader.
      So a subclass in gda.epics, with a different class loader, trying to call this function in a package-private way (from an inner class within the subclass) will fail with a runtime exception.
      See DAQ-1598 and linked tickets, and also https://bugs.eclipse.org/bugs/show_bug.cgi?id=152568

      TODO: Make protected if/when we have a solution the above-mentioned issue.

      Parameters:
      positionerStatus - The new value to set
    • getPositionerStatus

      public EnumPositionerStatus getPositionerStatus()
      Get the current positioner status
      This should also be made protected: see comment on setPositionerStatus(EnumPositionerStatus)
      Returns:
      Current status
    • getStatus

      public EnumPositionerStatus getStatus() throws DeviceException
      Description copied from interface: EnumPositioner
      Returns the current status
      Specified by:
      getStatus in interface EnumPositioner
      Returns:
      the status
      Throws:
      DeviceException
    • isBusy

      public boolean isBusy() throws DeviceException
      Description copied from interface: Scannable
      Check if the Scannable is moving/operating.
      Specified by:
      isBusy in interface Scannable
      Returns:
      true - if operation carried out by moveTo has not completed yet
      Throws:
      DeviceException
    • checkPositionValid

      public String checkPositionValid(Object position)
      Description copied from class: ScannableBase
      This default behaviour should be extended by most subclasses! Tests if the given object is meaningful to this Scannable and so could be used by one of the move commands. May check limits and other things too. This is the method called by scans on all points before the scan is run.
      Specified by:
      checkPositionValid in interface Scannable
      Overrides:
      checkPositionValid in class ScannableBase
      Parameters:
      position -
      Returns:
      null if position is valid, or returns a description if not.
      See Also:
    • isInPos

      public boolean isInPos() throws DeviceException
      Simple implementation that may not be reliable.
      Devices with a PV that indicates whether the device is in position should use this instead.
      Specified by:
      isInPos in interface EnumPositioner
      Throws:
      DeviceException
    • toFormattedString

      public String toFormattedString()
      Description copied from interface: Scannable
      Returns a string representation of the Scannable and its current position/value/status

      Typically should return:

      name : position

      or for detectors, name : status

      If the position/status cannot be determined, the function should return Scannable.VALUE_UNAVAILABLE in its place.

      Specified by:
      toFormattedString in interface Scannable
      Overrides:
      toFormattedString in class ScannableBase
      Returns:
      string as defined above
    • createFormattedListAcceptablePositions

      protected String createFormattedListAcceptablePositions()
      Formats the available positions into a list e.g ('pos1' 'pos2' 'pos3')
      Returns:
      formatted positions list