java.lang.Object
provided.utils.valueGenerator.impl.SineMaker
- All Implemented Interfaces:
ISineMaker
A utility class that can be used to create smoothly varying sinusoidal
numerical data.
Note that this is not a singleton class nor does it have static methods as
its behavior depends on the minimum, maximum and delta values given to
its constructor.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate double
The amplitude of the sinusoidal outputprivate double
The amount that _theta is incremented each time, in radians.private double
The midpoint of the min and max values.private double
The current angle used to generate the current sinusoidal value. -
Constructor Summary
ConstructorsConstructorDescriptionSineMaker(double min, double max, double delta)
The constructor takes several values to control the object's behavior. -
Method Summary
-
Field Details
-
_mid
private double _midThe midpoint of the min and max values. -
_ampl
private double _amplThe amplitude of the sinusoidal output -
_delta
private double _deltaThe amount that _theta is incremented each time, in radians. -
_theta
private double _thetaThe current angle used to generate the current sinusoidal value. Initialized to produce the minimum value.
-
-
Constructor Details
-
SineMaker
public SineMaker(double min, double max, double delta)The constructor takes several values to control the object's behavior.- Parameters:
min
- The minimum and initial value to produce.max
- The maximum value to produce.delta
- The amount in radians that the generating angle is incremented each time
-
-
Method Details
-
getDblVal
public double getDblVal()Description copied from interface:ISineMaker
Returns a different value each time it is called. The value varies smoothly in a sinusoidal fashion, incrementing each time as per the above specified delta angle increase.- Specified by:
getDblVal
in interfaceISineMaker
- Returns:
- the next value as a double
-
getIntVal
public int getIntVal()Description copied from interface:ISineMaker
Same as getDblVal, but returns the result rounded to the nearest integer. Note that getDblVal and getIntVal are not independent as getIntVal merely calls getDblVal.- Specified by:
getIntVal
in interfaceISineMaker
- Returns:
- the next value as an int
-