Package jisa.control
Class Repeat
- java.lang.Object
-
- jisa.control.Repeat
-
- All Implemented Interfaces:
java.lang.Iterable<java.lang.Double>
public class Repeat extends java.lang.Object implements java.lang.Iterable<java.lang.Double>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Repeat.Measurement
-
Constructor Summary
Constructors Constructor Description Repeat(int count, int delay, Repeat.Measurement measurement)
Creates a Repeat object - for performing repeat measurements.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getCount()
int
getDelay()
double
getMax()
double
getMean()
double
getMin()
double
getRange()
double
getStandardDeviation()
double
getSum()
double
getValue(int repeat)
java.util.List<java.lang.Double>
getValues()
double
getVariance()
boolean
isComplete()
java.util.Iterator<java.lang.Double>
iterator()
static Repeat
prepare(int count, int delay, Repeat.Measurement measurement)
Creates a repeat measurement without running it, returning it as a Repeat object.void
run()
static Repeat
run(int count, int delay, Repeat.Measurement measurement)
Creates and runs a repeat measurement, returning it as a Repeat object after performing all repeat measurements.static void
runInParallel(Repeat... repeats)
static void
runTogether(Repeat... repeats)
Runs multiple repeat measurements together side-by-side.
-
-
-
Constructor Detail
-
Repeat
public Repeat(int count, int delay, Repeat.Measurement measurement)
Creates a Repeat object - for performing repeat measurements. The repeat will not run until run() is called.- Parameters:
count
- The number of repeats to performdelay
- The delay, in milliseconds, to wait before each repeatmeasurement
- The measurement to repeat
-
-
Method Detail
-
run
public static Repeat run(int count, int delay, Repeat.Measurement measurement) throws java.lang.Exception
Creates and runs a repeat measurement, returning it as a Repeat object after performing all repeat measurements.- Parameters:
count
- Number of repeatsdelay
- Delay in milliseconds before each repeatmeasurement
- The measurement to run- Returns:
- Repeat object containing the repeated measurements
- Throws:
java.lang.Exception
- Upon error running measurement
-
prepare
public static Repeat prepare(int count, int delay, Repeat.Measurement measurement)
Creates a repeat measurement without running it, returning it as a Repeat object. Will not run until run() is called on it.- Parameters:
count
- Number of repeatsdelay
- Delay in milliseconds before each repeatmeasurement
- The measurement to run- Returns:
- Repeat object, awaiting run.
-
runTogether
public static void runTogether(Repeat... repeats) throws java.lang.Exception
Runs multiple repeat measurements together side-by-side. Each Repeat must be configured to have the same count and delay time.- Parameters:
repeats
- The Repeat objects to run- Throws:
java.lang.Exception
- Upon measurement error, or if the Repeat objects have differing counts and/or delays.
-
runInParallel
public static void runInParallel(Repeat... repeats) throws java.lang.Exception
- Throws:
java.lang.Exception
-
run
public void run() throws java.lang.Exception
- Throws:
java.lang.Exception
-
isComplete
public boolean isComplete()
-
getValues
public java.util.List<java.lang.Double> getValues()
-
getValue
public double getValue(int repeat)
-
getMin
public double getMin()
-
getMax
public double getMax()
-
getRange
public double getRange()
-
getSum
public double getSum()
-
getCount
public int getCount()
-
getDelay
public int getDelay()
-
getMean
public double getMean()
-
getVariance
public double getVariance()
-
getStandardDeviation
public double getStandardDeviation()
-
iterator
public java.util.Iterator<java.lang.Double> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<java.lang.Double>
-
-