Class AtomicInput
- java.lang.Object
-
- io.engineblock.activityimpl.input.AtomicInput
-
- All Implemented Interfaces:
ActivityDefObserver,Input,ProgressCapable
public class AtomicInput extends java.lang.Object implements Input, ActivityDefObserver, ProgressCapable
TODO: This documentation is out of date as of 2.0.0
This input will provide threadsafe access to a sequence of long values.
Changes to the cycles or the targetrate will affect the provided inputs. If the min or max cycle is changed, then these are re-applied first to the max cycle and then to the min cycle. If the min cycle is changed, then the next cycle value is set to the assigned min value. Otherwise, the cycle will continue as usual till it reaches the max value. The ability to start the input while running by applying a new set of parameters makes it possible to re-trigger a sequence of inputs during a test.
This input, and Inputs in general do not actively prevent usage of values after the max value. They simply expose it to callers. It is up to the caller to check the value to determine when the input is deemed "used up."
-
-
Constructor Summary
Constructors Constructor Description AtomicInput(ActivityDef activityDef)
-
Method Summary
Modifier and Type Method Description CycleSegmentgetInputSegment(int stride)Return the next InputSegment available, or null if none were available.doublegetProgress()java.lang.StringgetProgressDetails()doublegetTotal()booleanisContiguous()voidonActivityDefUpdate(ActivityDef activityDef)java.lang.StringtoString()
-
-
-
Constructor Detail
-
AtomicInput
public AtomicInput(ActivityDef activityDef)
-
-
Method Detail
-
getInputSegment
public CycleSegment getInputSegment(int stride)
Description copied from interface:InputReturn the next InputSegment available, or null if none were available. This method is required to be thread safe.All implementations of this method are required to be thread-safe.
- Specified by:
getInputSegmentin interfaceInput- Parameters:
stride- The number of cycles (not necessarily contiguous) in the segment.- Returns:
- a segment, or null if none available.
-
getProgress
public double getProgress()
- Specified by:
getProgressin interfaceProgressCapable
-
getTotal
public double getTotal()
- Specified by:
getTotalin interfaceProgressCapable
-
getProgressDetails
public java.lang.String getProgressDetails()
- Specified by:
getProgressDetailsin interfaceProgressCapable
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
onActivityDefUpdate
public void onActivityDefUpdate(ActivityDef activityDef)
- Specified by:
onActivityDefUpdatein interfaceActivityDefObserver
-
isContiguous
public boolean isContiguous()
- Specified by:
isContiguousin interfaceInput
-
-