All Packages Class Hierarchy This Package Previous Next Index
Class crw.data.FunctionData
java.lang.Object
|
+----crw.data.Data
|
+----crw.data.FunctionData
- public abstract class FunctionData
- extends Data
An abstract class to represent a theoretical Function to plot.
A subclass must implement the function to plot f(x,p) and
isCurrentDrawable(). The x-range and y-range are set in the
superclass Data() constructor. However, the y-range is computed from
FunctionData's function-f. Therefore, if the function
f(double, double) value depends on any of FunctionData's
subclass variable, then these variables (for function-f) must be
be initialized in a static initializer.
- Version:
- 0.0 3/31/1998
- Author:
- C.R.Wie
-
NOPOINTS
- Number of data points calculated.
-
FunctionData()
-
-
f(double, double)
- Mathematical function to be plotted.
-
getCurrentY(double)
- This method is called by the system, i.e., DataWrapper and PlotCanvas
classes, to calculate and plot the curve corresponding to the current
value of parameter.
-
getX()
- Calculates and returns x[] from xRange.
-
getY()
- Uses f(x,p) to calculate the y-arrays.
-
getY(double, double)
-
-
isCurrentDrawable()
- This method should be overriden if a curve corresponding to the
current parameter value should be drawn.
-
setBooleanParam(boolean)
- A placeholder method, which may be overriden to control a condition
in the f(x,p) calculation.
-
setDoubleParam(double)
- This method may be overriden in the subclass to control one constant
or one parameter in the function f(x, p).
-
setXRange()
- Subclass should override this method to set the xRange.
NOPOINTS
protected static final int NOPOINTS
- Number of data points calculated.
FunctionData
public FunctionData()
f
protected abstract double f(double x,
double p)
- Mathematical function to be plotted. The x-points should be specified
in getX() method, and parameter p-points must be specified in the
getParam() method. This function must be provided in subclass, but
is by getY() and getCurrentY(p) methods to calculate the y-arrays.
- Parameters:
- x - the independent variable.
- p - the parameter for a parameterized-curve.
- Returns:
- the y-value
isCurrentDrawable
public boolean isCurrentDrawable()
- This method should be overriden if a curve corresponding to the
current parameter value should be drawn. Default is false.
This method is called by the system only if the data is a family
of curves.
- Returns:
- true if the current curve should be plotted.
getCurrentY
public double[] getCurrentY(double p)
- This method is called by the system, i.e., DataWrapper and PlotCanvas
classes, to calculate and plot the curve corresponding to the current
value of parameter.
- Parameters:
- p - the current value of parameter.
- Returns:
- current y-array
setDoubleParam
public void setDoubleParam(double param)
- This method may be overriden in the subclass to control one constant
or one parameter in the function f(x, p). Best used to control a
physical constant in the function.
- Parameters:
- param - a new value of the physical parameter.
setBooleanParam
public void setBooleanParam(boolean param)
- A placeholder method, which may be overriden to control a condition
in the f(x,p) calculation.
- Parameters:
- param - the new boolean state.
getY
public double getY(double x,
double p)
- Returns:
- f(x,p)
getX
public double[] getX()
- Calculates and returns x[] from xRange.
- Overrides:
- getX in class Data
getY
public double[][] getY()
- Uses f(x,p) to calculate the y-arrays. If a single curve (i.e., getParam()
returns null), it returns double[1][] data. This method is used
by the system whenever the full data need be plotted.
- Returns:
- the parameterized y-array.
- Overrides:
- getY in class Data
setXRange
protected abstract void setXRange()
- Subclass should override this method to set the xRange.
All Packages Class Hierarchy This Package Previous Next Index