Class MockScannable
java.lang.Object
org.eclipse.scanning.api.AbstractNameable
org.eclipse.scanning.api.AbstractNameableTimeoutable
org.eclipse.scanning.api.AbstractScannable<Number>
org.eclipse.scanning.api.CountableScannable<Number>
org.eclipse.scanning.example.scannable.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
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.scanning.api.ITerminatable
ITerminatable.TerminationPreference -
Field Summary
FieldsFields inherited from class org.eclipse.scanning.api.AbstractScannable
delegate -
Constructor Summary
ConstructorsConstructorDescriptionMockScannable(Number position) MockScannable(String name, Number position) MockScannable(String name, Number position, int level) MockScannable(String name, Number position, int level, boolean requireSleep) MockScannable(String name, Number position, int level, String unit) -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Call to terminate a movement before it is complete, for example when ScannablePositioner#abort is called due to an exception with another IScannable's movementprotected NumberdoRealisticMove(Number pos, int index, long minimumWaitTime) protected static booleanequalsWithinTolerance(Number foo, Number bar, Number tolerance) The upper limit in the same unit as the position.The lower limit in the same unit as the position.doubleThe position is the value which should be: 1.getUnit()The unit is the unit in which the setPosition and getPosition values are in.booleanbooleanvoidsetInitialPosition(Number position) setMaximum(Number upper) setMinimum(Number lower) voidsetMoveRate(double moveRate) setPosition(Number position) Moves to the position required, blocking until it is complete.setPosition(Number value, IPosition loc) Moves to the position required, blocking until it is complete.voidsetRealisticMove(boolean realisticMove) voidsetRequireSleep(boolean requireSleep) voidvoid## Blocking Call ##toString()voidMethods inherited from class org.eclipse.scanning.api.CountableScannable
count, getCount, getMethodName, resetCountMethods inherited from class org.eclipse.scanning.api.AbstractScannable
addPositionListener, getDeviceInformation, getLevel, getModel, getScanAttribute, getScanAttributeNames, getTolerance, isActivated, register, removePositionListener, setActivated, setLevel, setModel, setPublisher, setScanAttribute, setToleranceMethods inherited from class org.eclipse.scanning.api.AbstractNameableTimeoutable
equals, getTimeout, hashCode, setTimeoutMethods inherited from class org.eclipse.scanning.api.AbstractNameable
getName, setNameMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.scanning.api.IBoundable
getPermittedValuesMethods inherited from interface org.eclipse.scanning.api.scan.event.IPositionListenable
getPositioner, setPositionerMethods inherited from interface org.eclipse.scanning.api.ITimeoutable
getTimeout, setTimeout
-
Field Details
-
position
-
-
Constructor Details
-
MockScannable
public MockScannable() -
MockScannable
-
MockScannable
-
MockScannable
-
MockScannable
-
MockScannable
-
-
Method Details
-
getPosition
Description copied from interface:IBoundableThe 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:
getPositionin interfaceIBoundable<Number>- Returns:
-
setPosition
Description copied from interface:IScannableMoves to the position required, blocking until it is complete. Similar to moveTo(...) in GDA8 Same as calling setPosition(value, null);- Specified by:
setPositionin interfaceIScannable<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
-
setPosition
Description copied from interface:IScannableMoves to the position required, blocking until it is complete. Similar to moveTo(...) in GDA8- Specified by:
setPositionin interfaceIScannable<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
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:
terminatein interfaceITerminatable- Parameters:
pref-- Throws:
Exception
-
toString
- Overrides:
toStringin classAbstractNameableTimeoutable
-
isRequireSleep
public boolean isRequireSleep() -
setRequireSleep
public void setRequireSleep(boolean requireSleep) -
verify
- Throws:
Exception
-
getValues
-
equalsWithinTolerance
-
getUnit
Description copied from interface:IScannableThe unit is the unit in which the setPosition and getPosition values are in.- Specified by:
getUnitin interfaceIScannable<Number>- Returns:
- String representation of unit which setPosition and getPosition are using.
-
setUnit
-
getMaximum
Description copied from interface:IBoundableThe upper limit in the same unit as the position.- Specified by:
getMaximumin interfaceIBoundable<Number>- Overrides:
getMaximumin classAbstractScannable<Number>- Returns:
- null if there is no upper limit. In this case it will be the upper limit of the type T.
-
setMaximum
- Overrides:
setMaximumin classAbstractScannable<Number>
-
getMinimum
Description copied from interface:IBoundableThe lower limit in the same unit as the position.- Specified by:
getMinimumin interfaceIBoundable<Number>- Overrides:
getMinimumin classAbstractScannable<Number>- Returns:
- null if there is no upper limit. In this case it will be the upper limit of the type T.
-
setMinimum
- Overrides:
setMinimumin classAbstractScannable<Number>
-
isRealisticMove
public boolean isRealisticMove() -
setRealisticMove
public void setRealisticMove(boolean realisticMove) -
getMoveRate
public double getMoveRate() -
setMoveRate
public void setMoveRate(double moveRate) -
abort
Description copied from interface:IScannableCall 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:
abortin interfaceIScannable<Number>- Throws:
ScanningExceptionInterruptedException
-