Class MockTopupScannable
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
org.eclipse.scanning.example.scannable.MockTopupScannable
- All Implemented Interfaces:
AutoCloseable,IActivatable,IConnection,IBoundable<Number>,ILevel,INameable,IScanAttributeContainer,IScannable<Number>,ITerminatable,ITimeoutable,ITolerable<Number>,IPositionListenable
Designed to monitor topup (pretty badly, just conceptually).
On a step divisible by ten, will force a wait
until imaginary topup value is reached.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.scanning.api.ITerminatable
ITerminatable.TerminationPreference -
Field Summary
Fields inherited from class org.eclipse.scanning.example.scannable.MockScannable
positionFields inherited from class org.eclipse.scanning.api.AbstractScannable
delegate -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCall to disconnect any resources which we no longer need.longbooleanReturns whether this connection is connected.voidsetPeriod(long period) setPosition(Number position) Moves to the position required, blocking until it is complete.setPosition(Number position, IPosition loc) Moves to the position required, blocking until it is complete.voidstart()Methods inherited from class org.eclipse.scanning.example.scannable.MockScannable
abort, doRealisticMove, equalsWithinTolerance, getMaximum, getMinimum, getMoveRate, getPosition, getUnit, getValues, isRealisticMove, isRequireSleep, setInitialPosition, setMaximum, setMinimum, setMoveRate, setRealisticMove, setRequireSleep, setUnit, terminate, toString, verifyMethods 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.event.core.IConnection
closeMethods inherited from interface org.eclipse.scanning.api.scan.event.IPositionListenable
getPositioner, setPositionerMethods inherited from interface org.eclipse.scanning.api.ITimeoutable
getTimeout, setTimeout
-
Constructor Details
-
MockTopupScannable
- Parameters:
name-period- in ms that topup happens over e.g. 5000 for testing
-
-
Method Details
-
start
public void start() -
disconnect
public void disconnect()Description copied from interface:IConnectionCall to disconnect any resources which we no longer need. The resource may have timed out so it might not be connected, in that case it silently returns. Note, that the methodIConnection.close(), inherited fromAutoCloseablecalls this method, which means that if an object of a class implementingIConnectionis used with a try-with-resources block this method will be called automatically when exiting that block.- Specified by:
disconnectin interfaceIConnection
-
isConnected
public boolean isConnected()Description copied from interface:IConnectionReturns whether this connection is connected. This method returnstrueuntil disconnect is called, even if the connection is created lazily.- Specified by:
isConnectedin interfaceIConnection- Returns:
trueif connected,falseotherwise
-
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>- Overrides:
setPositionin classMockScannable- 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
-
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>- Overrides:
setPositionin classMockScannable- Parameters:
position- 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
-
getPeriod
public long getPeriod() -
setPeriod
public void setPeriod(long period)
-