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

Variable Index

 o NOPOINTS
Number of data points calculated.

Constructor Index

 o FunctionData()

Method Index

 o f(double, double)
Mathematical function to be plotted.
 o 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.
 o getX()
Calculates and returns x[] from xRange.
 o getY()
Uses f(x,p) to calculate the y-arrays.
 o getY(double, double)
 o isCurrentDrawable()
This method should be overriden if a curve corresponding to the current parameter value should be drawn.
 o setBooleanParam(boolean)
A placeholder method, which may be overriden to control a condition in the f(x,p) calculation.
 o setDoubleParam(double)
This method may be overriden in the subclass to control one constant or one parameter in the function f(x, p).
 o setXRange()
Subclass should override this method to set the xRange.

Variables

 o NOPOINTS
 protected static final int NOPOINTS
Number of data points calculated.

Constructors

 o FunctionData
 public FunctionData()

Methods

 o 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
 o 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.
 o 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
 o 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.
 o 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.
 o getY
 public double getY(double x,
                    double p)
Returns:
f(x,p)
 o getX
 public double[] getX()
Calculates and returns x[] from xRange.

Overrides:
getX in class Data
 o 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
 o setXRange
 protected abstract void setXRange()
Subclass should override this method to set the xRange.


All Packages  Class Hierarchy  This Package  Previous  Next  Index