Class CoupledScannable

All Implemented Interfaces:
INeXusInfoWriteable, Device, Scannable, ScannableMotion, ScannableMotionUnits, Configurable, Findable, gda.observable.IObservable
Direct Known Subclasses:
I23FluoScanEnergyControllerWrapper, SequentialScannable

Couples together the movement of several other Scannables.

This scannable returns its position as the array of positions of the sub-Scannables, but its movement is defined by a single number. The Scannables' movements are coupled to this number by functions.

There must be a Function per Scannable, else an exception will be thrown during the configure() method. Note that currently all Functions return a single value, so all Scannables used here must have one input value.

  • Field Details

  • Constructor Details

    • CoupledScannable

      public CoupledScannable()
  • Method Details

    • configure

      public void configure() throws FactoryException
      This must be called after all Scannables and Functions added Default implementation for classes that do not have to do any specific configuration.
      Classes that do their own configuration should *not* call this superclass function, as it may cause the object to appear configured before it really is.
      Specified by:
      configure in interface Configurable
      Overrides:
      configure in class ConfigurableBase
      Throws:
      FactoryException - if there is an error in configuration e.g. required variable not set or cannot connect to device
      See Also:
    • getScannables

      public List<Scannable> getScannables()
      Returns:
      all the Scannables this operates
    • setScannables

      public void setScannables(List<Scannable> theScannables)
      Sets the scannables this object uses. Use this instead of multiple calls to addScannable.
      Parameters:
      theScannables -
    • setFunctions

      public void setFunctions(List<Function<javax.measure.Quantity<? extends javax.measure.Quantity<?>>,javax.measure.Quantity<? extends javax.measure.Quantity<?>>>> functions)
      Sets the functions in this coupled scannable.
      Parameters:
      functions - the functions
    • getFunctions

      public List<Function<javax.measure.Quantity<? extends javax.measure.Quantity<?>>,javax.measure.Quantity<? extends javax.measure.Quantity<?>>>> getFunctions()
      Returns:
      all the functions this uses.
    • rawAsynchronousMoveTo

      public void rawAsynchronousMoveTo(Object position) throws DeviceException
      Description copied from class: ScannableBase
      [Consider abstract] Trigger a move/operation to an internal/hardware position and return immediately.
      Overrides:
      rawAsynchronousMoveTo in class ScannableBase
      Parameters:
      position - Position in its internal/hardware representation. e.g. with units and offsets removed
      Throws:
      DeviceException
      See Also:
    • asynchronousMoveTo

      public void asynchronousMoveTo(Object position) throws DeviceException
      Description copied from class: ScannableBase
      Trigger a move/operation and return immediately. Implementations of this method should be non-blocking to allow concurrent motion; the isBusy method will be used to determine when the move has completed. Converts the external (user) position to an internal position and passes this to rawAsynchronousMoveTo.
      Specified by:
      asynchronousMoveTo in interface Scannable
      Overrides:
      asynchronousMoveTo in class ScannableMotionBase
      Parameters:
      position - Position to move to should have an element for each input field.
      Throws:
      DeviceException
    • moveUnderlyingScannables

      protected void moveUnderlyingScannables(List<? extends Object> targets) throws DeviceException
      Throws:
      DeviceException
    • getPosition

      public Object getPosition() throws DeviceException
      Description copied from class: ScannableBase
      Returns the current position of the Scannable. Called by ConcurentScan at the end of the point. Reads an internal (hardware) position from rawGetPosition, converts this to an external (user) position and returns it.
      Specified by:
      getPosition in interface Scannable
      Overrides:
      getPosition in class ScannableBase
      Returns:
      Current position with an element for each input and extra field. null if their are no fields.
      Throws:
      DeviceException
    • rawGetPosition

      public Object rawGetPosition() throws DeviceException
      Description copied from class: ScannableBase
      [Consider abstract] Read the position in its internal (user) representation.
      Overrides:
      rawGetPosition in class ScannableBase
      Returns:
      the value represented by this Scannable
      Throws:
      DeviceException
      See Also:
    • isBusy

      public boolean isBusy() throws DeviceException
      Description copied from class: ScannableMotionBase
      Check if the Scannable is moving/operating.. Calls onto rawIsBusy for historical reasons, although there is currently no need for this.
      Specified by:
      isBusy in interface Scannable
      Overrides:
      isBusy in class ScannableMotionBase
      Returns:
      true - if operation carried out by moveTo has not completed yet
      Throws:
      DeviceException
      See Also:
    • handleUpdate

      protected void handleUpdate(Object theObserved, Object changeCode)
    • stop

      public void stop() throws DeviceException
      Description copied from class: ScannableBase
      Stop the current move/operation. Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.
      Specified by:
      stop in interface Scannable
      Overrides:
      stop in class ScannableBase
      Throws:
      DeviceException
      See Also:
    • 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 ScannableMotionUnitsBase
      Returns:
      string as defined above