Class CoordinatedScannableGroup

All Implemented Interfaces:
Device, Scannable, IScannableGroup, Configurable, Findable, gda.observable.IObservable, gda.observable.IObserver
Direct Known Subclasses:
DeferredScannableGroup

public class CoordinatedScannableGroup extends ScannableGroup
Extends ScannableGroup to provide coordinated moves. When the group's members are moved via the scan or pos command (see below for mechanism), the move requests will be stored up and sent via a single call to the group's asynchronousMoveTo() method.

Note that even though the group may be in the internal state TARGETING, it is still possible that some of the components may have been asked to move externally, and that they may be moving, i.e. the group performs no locking.

Members passed in to be added to the group will be wrapped in one of CoordinatedElementScannableMotionUnits, CoordinatedElementScannableMotion or CoordinatedElementScannable determined by the interface they support. This means that any methods not in one of these interfaces will not be accessible.

  • Field Details

    • coordinatedScannableComponent

      protected gda.device.scannable.scannablegroup.CoordinatedParentScannableComponent coordinatedScannableComponent
  • Constructor Details

    • CoordinatedScannableGroup

      public CoordinatedScannableGroup()
      Create the group. Members must be added for the group to do anything useful.
  • Method Details

    • checkPositionValid

      public String checkPositionValid(Object pos) throws DeviceException
      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 ScannableGroup
      Parameters:
      pos -
      Returns:
      null if position is valid, or returns a description if not.
      Throws:
      DeviceException
      See Also:
    • setGroupMembers

      public void setGroupMembers(List<Scannable> groupMembers) throws FactoryException
      Description copied from class: ScannableGroup
      Sets the group members that make up this scannable group. If this ScannableGroup is configured, sets it to unconfigured, to allow all the scannables to be configured by call this.configure()
      Specified by:
      setGroupMembers in interface IScannableGroup
      Overrides:
      setGroupMembers in class ScannableGroup
      Parameters:
      groupMembers - the group members
      Throws:
      FactoryException
    • addGroupMember

      public void addGroupMember(Scannable groupMember) throws FactoryException
      Description copied from class: ScannableGroup
      Adds a scannable to this group. This will not add a Scannable if it is already included Will configure the Scannable if the ScannableGroup is already configured
      Specified by:
      addGroupMember in interface IScannableGroup
      Overrides:
      addGroupMember in class ScannableGroup
      Parameters:
      groupMember -
      Throws:
      FactoryException
    • wrapScannable

      protected gda.device.scannable.scannablegroup.ICoordinatedChildScannable wrapScannable(Scannable delegate)
      Wraps a scannable with an ICoordinatedScannableElement to mediates access to the 'real' delegate scannable. coordinated moves. Note that only methods on ScannableMotionUnits, ScannableMotion or Scannable will be brought out.
      Parameters:
      delegate -
      Returns:
      the wrapped scannable
    • 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 ScannableGroup
      Parameters:
      position - Position to move to should have an element for each input field.
      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
      Overrides:
      isBusy in class ScannableGroup
      Returns:
      true - if operation carried out by moveTo has not completed yet
      Throws:
      DeviceException
    • atCommandFailure

      public void atCommandFailure() throws DeviceException
      Description copied from class: ScannableBase
      Hook to be used by Scan and pos commands to inform the Scannable that an exception, such as a DeviceExcpetion, has occurred. However not called when the command is aborted using an InterruptionException. If a Scan is aborted then only Scannable.stop() will be called by the Scan or pos command.

      Useful for telling Scannables which hold state during a scan for example, to reset themselves. Used for example by CoordinatedMotionScannables. This hook should be used not in the same way as the stop hook. Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.

      Specified by:
      atCommandFailure in interface Scannable
      Overrides:
      atCommandFailure in class ScannableGroup
      Throws:
      DeviceException
      See Also:
    • atLevelMoveStart

      public void atLevelMoveStart()
      Description copied from class: ScannableBase
      Called by both the pos and scan commands at the start of each subsequent level move only on Scannables that will be moved as part that level's movement.

      For example "pos a 1 b 2 c 3", will, if a and b have the same level and c a higher level will result in:

       a.atLevelMoveStart()   invalid input: '<'----
       b.atLevelMoveStart()   invalid input: '<'----
       a.asynchronousMoveTo()
       b.asynchronousMoveTo()
       a.waitWhileBusy()
       b.waitWhileBusy()
       c.atLevelMoveStart()   invalid input: '<'----
       c.asynchronousMoveTo()
       c.waitWhileBusy()
       
      This hook is used by CoordinatedMotionScannables. Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.
      Specified by:
      atLevelMoveStart in interface Scannable
      Overrides:
      atLevelMoveStart in class ScannableGroup
      See Also:
    • addChildToMove

      public void addChildToMove(gda.device.scannable.scannablegroup.ICoordinatedChildScannable element)
    • isTargeting

      public boolean isTargeting()
    • setChildTarget

      public void setChildTarget(gda.device.scannable.scannablegroup.ICoordinatedChildScannable element, Object position) throws DeviceException
      Throws:
      DeviceException
    • getPositionWhileMovingContinuousely

      public Object getPositionWhileMovingContinuousely(gda.device.scannable.scannablegroup.ICoordinatedScannableGroupChildScannable childScannable) throws DeviceException
      Throws:
      DeviceException
    • checkAdditionalPositionValidators

      protected String checkAdditionalPositionValidators(Object externalPos) throws DeviceException
      Throws:
      DeviceException
    • setAdditionalPositionValidators

      public void setAdditionalPositionValidators(LinkedHashMap<String,PositionValidator> additionalPositionValidators)
      Set the additional position validators. An ordered map is used so that the validators can be compared in the same order each time. NOTE: Spring uses ordered maps by default when injecting maps.
      Parameters:
      additionalPositionValidators -
    • addPositionValidator

      public void addPositionValidator(String name, PositionValidator validator)
      Validators will be tested in the order that they have been added.
      Parameters:
      name -
      validator -
    • getAdditionalPositionValidators

      public LinkedHashMap<String,PositionValidator> getAdditionalPositionValidators()
    • __str__

      public String __str__()
      Description copied from class: ScannableBase
      Jython method to return string description of the object
      Overrides:
      __str__ in class ScannableBase
      Returns:
      the result of the toString method
    • __repr__

      public String __repr__()
      Description copied from class: ScannableBase
      Jython method to return a string representation of the object
      Overrides:
      __repr__ in class ScannableBase
      Returns:
      the result of the toString method