util
Class SineMaker

java.lang.Object
  extended by util.SineMaker

public class SineMaker
extends Object

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
private  double _ampl
          The amplitude of the sinusoidal output
private  double _delta
          The amount that _theta is incremented each time, in radians.
private  double _mid
          The midpoint of the min and max values.
private  double _theta
          The current angle used to generate the current sinusoidal value.
 
Constructor Summary
SineMaker(double min, double max, double delta)
          The constructor takes several values to control the object's behavior.
 
Method Summary
 double getDblVal()
          Returns a different value each time it is called.
 int getIntVal()
          Same as getDblVal, but returns the result rounded to the nearest integer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_mid

private double _mid
The midpoint of the min and max values.


_ampl

private double _ampl
The amplitude of the sinusoidal output


_delta

private double _delta
The amount that _theta is incremented each time, in radians.


_theta

private double _theta
The current angle used to generate the current sinusoidal value. Initialized to produce the minimum value.

Constructor Detail

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 Detail

getDblVal

public double getDblVal()
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.


getIntVal

public int getIntVal()
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.