Class AbstractScannable<T>

Type Parameters:
T -
All Implemented Interfaces:
IActivatable, IBoundable<T>, ILevel, INameable, IScanAttributeContainer, IScannable<T>, ITimeoutable, ITolerable<T>, IPositionListenable
Direct Known Subclasses:
BeamScannable, CompositeNexusScannable, CountableScannable, DetectorCollectionScannable, FrameCollectingScannable, MockStringScannable, NexusSlitsWrapper, ScannableNexusWrapper

public abstract class AbstractScannable<T> extends AbstractNameableTimeoutable implements IScannable<T>, IScanAttributeContainer, IPositionListenable
Convenience class using inheritance to contain some of the general things a scannable does that are the same for all scannables. NOTE: Inheritance is designed to have three levels only IScannable->AbstractScannable->A device The preferred alternative if more complex behaviour is required would be to create delegates for these interfaces which are then aggregated in the device.
  • Field Details

    • delegate

      protected PositionDelegate delegate
      Implementors should use the delegate to notify of position.
  • Constructor Details

    • AbstractScannable

      protected AbstractScannable()
    • AbstractScannable

      protected AbstractScannable(IPublisher<Location> publisher)
      Parameters:
      publisher -
      sservice -
  • Method Details

    • register

      public void register()
      Used by spring to register the detector with the Runnable device service *WARNING* Before calling register the detector must be given a service to register this. This can be done from the constructor super(IRunnableDeviceService) of the detector to make it easy to instantiate a no-argument detector and register it from spring.
    • addPositionListener

      public void addPositionListener(IPositionListener listener)
      Description copied from interface: IPositionListenable
      Use to be notified as levels / positions are reached. Not usually necessary as setPosition is blocking until the position is reached but useful for other objects which need to change when new positions are reached.
      Specified by:
      addPositionListener in interface IPositionListenable
      Parameters:
      listener -
    • removePositionListener

      public void removePositionListener(IPositionListener listener)
      Description copied from interface: IPositionListenable
      Use to be notified as levels / positions are reached.
      Specified by:
      removePositionListener in interface IPositionListenable
      Parameters:
      listener -
    • setPublisher

      public void setPublisher(IPublisher<Location> publisher)
    • getScanAttributeNames

      public Set<String> getScanAttributeNames()
      Specified by:
      getScanAttributeNames in interface IScanAttributeContainer
      Returns:
      null if no attributes, otherwise collection of the names of the attributes set
    • setScanAttribute

      public <A> void setScanAttribute(String attributeName, A value) throws Exception
      Set any attribute the implementing classes may provide
      Specified by:
      setScanAttribute in interface IScanAttributeContainer
      Parameters:
      attributeName - is the name of the attribute
      value - is the value of the attribute
    • getScanAttribute

      public <A> A getScanAttribute(String attributeName) throws Exception
      Get the value of the specified attribute
      Specified by:
      getScanAttribute in interface IScanAttributeContainer
      Parameters:
      attributeName - is the name of the attribute
      Returns:
      the value of the attribute
    • getDeviceInformation

      public DeviceInformation<T> getDeviceInformation()
    • getLevel

      public int getLevel()
      Description copied from interface: ILevel
      get the operation level of this scannable.
      Specified by:
      getLevel in interface ILevel
      Returns:
      int - the level
    • setLevel

      public void setLevel(int level)
      Description copied from interface: ILevel
      Used for ordering the operations of Scannables during scans
      Specified by:
      setLevel in interface ILevel
      Parameters:
      level -
    • getMaximum

      public T getMaximum()
      Description copied from interface: IBoundable
      The upper limit in the same unit as the position.
      Specified by:
      getMaximum in interface IBoundable<T>
      Returns:
      null if there is no upper limit. In this case it will be the upper limit of the type T.
    • setMaximum

      public T setMaximum(T upper)
    • getMinimum

      public T getMinimum()
      Description copied from interface: IBoundable
      The lower limit in the same unit as the position.
      Specified by:
      getMinimum in interface IBoundable<T>
      Returns:
      null if there is no upper limit. In this case it will be the upper limit of the type T.
    • setMinimum

      public T setMinimum(T lower)
    • isActivated

      public boolean isActivated()
      Specified by:
      isActivated in interface IActivatable
      Returns:
      true if device is activated.
    • setActivated

      public boolean setActivated(boolean activated)
      Specified by:
      setActivated in interface IActivatable
      Parameters:
      activated -
      Returns:
      the old value of activated
    • getModel

      public <M> M getModel()
    • setModel

      public <M> void setModel(M model)
    • getTolerance

      public T getTolerance()
      Description copied from interface: ITolerable
      The tolerance is a value +/- position which when the position is still within this tolerance means that a setPosition(...) does nothing. This principle of tolerance allows jittery motors not to have value set when their current value is within acceptable accuracy or tolerance.
      Specified by:
      getTolerance in interface ITolerable<T>
      Returns:
    • setTolerance

      public T setTolerance(T tolerance)
      Description copied from interface: ITolerable
      Set the tolerance which when set will allow setPosition(...) on the device to check if a position set is required. The tolerance is a value +/- position which when the position is still within this tolerance means that a setPosition(...) does nothing.
      Specified by:
      setTolerance in interface ITolerable<T>
      Parameters:
      tolerance -
      Returns:
      The previous value including null if tolerance is being set for the first time.