Class SineGenerator
- java.lang.Object
-
- org.epics.archiverappliance.utils.simulation.SineGenerator
-
- All Implemented Interfaces:
SimulationValueGenerator
public class SineGenerator extends Object implements SimulationValueGenerator
Generates a sine wave with a default period of one hour and a specifiable offset. Used for data generation in the unit tests.- Author:
- mshankar
-
-
Constructor Summary
Constructors Constructor Description SineGenerator(int phasediffindegress)
SineGenerator(int phasediffindegress, int numberofsamples)
-
Method Summary
Modifier and Type Method Description int
getNumberOfSamples(ArchDBRTypes type)
Get the number of events in the stream; this can be based on the incoming DBR_type.SampleValue
getSampleValue(ArchDBRTypes type, int secondsIntoYear)
Get the value at a particular point in time.
-
-
-
Method Detail
-
getNumberOfSamples
public int getNumberOfSamples(ArchDBRTypes type)
Description copied from interface:SimulationValueGenerator
Get the number of events in the stream; this can be based on the incoming DBR_type. If you want the simulation stream decide on the number of samples (perhaps based on the year), return -1 here and an appropriate default is chosen.- Specified by:
getNumberOfSamples
in interfaceSimulationValueGenerator
- Parameters:
type
- ArchDBRTypes- Returns:
- The number of samples
-
getSampleValue
public SampleValue getSampleValue(ArchDBRTypes type, int secondsIntoYear)
Description copied from interface:SimulationValueGenerator
Get the value at a particular point in time. Many unit tests rely on the value being returned being absolutely reproducible given the time.- Specified by:
getSampleValue
in interfaceSimulationValueGenerator
- Parameters:
type
- ArchDBRTypessecondsIntoYear
-- Returns:
- Sample value
-
-