Class MockScannable

All Implemented Interfaces:
IActivatable, IBoundable<Number>, ILevel, INameable, IScanAttributeContainer, IScannable<Number>, ITerminatable, ITimeoutable, ITolerable<Number>, IPositionListenable
Direct Known Subclasses:
MockBeamOnMonitor, MockCountingPositionScannable, MockNeXusScannable, MockNeXusSlit, MockPausingMonitor, MockTopupScannable

public class MockScannable extends CountableScannable<Number> implements ITerminatable
  • Field Details

    • position

      protected Number position
  • Constructor Details

    • MockScannable

      public MockScannable()
    • MockScannable

      public MockScannable(Number position)
    • MockScannable

      public MockScannable(String name, Number position)
    • MockScannable

      public MockScannable(String name, Number position, int level)
    • MockScannable

      public MockScannable(String name, Number position, int level, boolean requireSleep)
    • MockScannable

      public MockScannable(String name, Number position, int level, String unit)
  • Method Details

    • getPosition

      public Number getPosition()
      Description copied from interface: IBoundable
      The position is the value which should be: 1. Greater than or equal to the lower 2. Less than or equal to the upper. 3. One of the permitted values, if they are not null.
      Specified by:
      getPosition in interface IBoundable<Number>
      Returns:
    • setPosition

      public Number setPosition(Number position) throws ScanningException
      Description copied from interface: IScannable
      Moves to the position required, blocking until it is complete. Similar to moveTo(...) in GDA8 Same as calling setPosition(value, null);
      Specified by:
      setPosition in interface IScannable<Number>
      Parameters:
      position -
      Returns:
      the new position attained by the device, if known. (Saves additional call to getPosition()) If not know the demand value is returned. NOTE if null is returned the system will call getPosition() again.
      Throws:
      ScanningException
    • setInitialPosition

      public void setInitialPosition(Number position)
    • setPosition

      public Number setPosition(Number value, IPosition loc) throws ScanningException
      Description copied from interface: IScannable
      Moves to the position required, blocking until it is complete. Similar to moveTo(...) in GDA8
      Specified by:
      setPosition in interface IScannable<Number>
      Parameters:
      value - that this scalar should take.
      loc - if within in a scan or null if not within a scan.
      Returns:
      the new position attained by the device, if known. (Saves additional call to getPosition()) If not know the demand value is returned. NOTE if null is returned the system will call getPosition() again.
      Throws:
      ScanningException
    • doRealisticMove

      protected Number doRealisticMove(Number pos, int index, long minimumWaitTime) throws ScanningException
      Throws:
      ScanningException
    • terminate

      public void terminate(ITerminatable.TerminationPreference pref) throws Exception
      Description copied from interface: ITerminatable
      ## Blocking Call ##

      Terminate the move of a given device such that if it is moving, it will stop where it is. The termination preference defines if the device should do a panic stop if it supports such an action. Many devices have one type of stop, therefore in their cases the preference to panic or controlled (etc) is treated as aspiration rather than reality i.e. ignored.

      Important: This call is blocking, it does not only set a flag to stop the move and return but it blocks until we are done moving! For instance it uses a CountDownLatch which is started on the move and released whenever the move is exited.

      Specified by:
      terminate in interface ITerminatable
      Parameters:
      pref -
      Throws:
      Exception
    • toString

      public String toString()
      Overrides:
      toString in class AbstractNameableTimeoutable
    • isRequireSleep

      public boolean isRequireSleep()
    • setRequireSleep

      public void setRequireSleep(boolean requireSleep)
    • verify

      public void verify(Number value, IPosition point) throws Exception
      Throws:
      Exception
    • getValues

      public List<Number> getValues()
    • equalsWithinTolerance

      protected static boolean equalsWithinTolerance(Number foo, Number bar, Number tolerance)
    • getUnit

      public String getUnit()
      Description copied from interface: IScannable
      The unit is the unit in which the setPosition and getPosition values are in.
      Specified by:
      getUnit in interface IScannable<Number>
      Returns:
      String representation of unit which setPosition and getPosition are using.
    • setUnit

      public void setUnit(String unit)
    • getMaximum

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

      public Number setMaximum(Number upper)
      Overrides:
      setMaximum in class AbstractScannable<Number>
    • getMinimum

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

      public Number setMinimum(Number lower)
      Overrides:
      setMinimum in class AbstractScannable<Number>
    • isRealisticMove

      public boolean isRealisticMove()
    • setRealisticMove

      public void setRealisticMove(boolean realisticMove)
    • getMoveRate

      public double getMoveRate()
    • setMoveRate

      public void setMoveRate(double moveRate)
    • abort

      public void abort() throws ScanningException, InterruptedException
      Description copied from interface: IScannable
      Call to terminate a movement before it is complete, for example when ScannablePositioner#abort is called due to an exception with another IScannable's movement
      Specified by:
      abort in interface IScannable<Number>
      Throws:
      ScanningException
      InterruptedException