uk.co.jscieng
Interface Plottable
- public abstract interface Plottable
The Plottable interface is used to pass methods as arguments to the
functionPlot
commands.
To pass a function to be graphed as an argument to functionPlot
, we define a class to contain the function which implements the
Plottable
interface and defines the method f
. This
will look something like:
public class FunctionClass extends Plottable
{
public double f(double x)
{
...
}
}
We can then pass this method as an argument to functionPlot
by
creating an object of this class and passing that object:
FunctionClass o = new FunctionClass();
SciGraph.functionPlot(o);
- Version:
- 1.0
- Author:
- Richard J. Davies
- See Also:
SciGraph.functionPlot(uk.co.jscieng.Plottable, double, double, java.awt.Color, double)
Method Summary |
double |
f(double x)
The method f should be overridden in your class to calculate
whatever function you wish to graph. |
f
public double f(double x)
- The method
f
should be overridden in your class to calculate
whatever function you wish to graph.
- Parameters:
x
- The x-coordinate at which the function is to be evaluated.- Returns:
- The y-coordinate at that point.
- See Also:
Plottable