Class EDU.emporia.mathtools.PiecewiseLinearFunction
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class EDU.emporia.mathtools.PiecewiseLinearFunction

Object
   |
   +----MathFunction
           |
           +----EDU.emporia.mathtools.PiecewiseLinearFunction

public class PiecewiseLinearFunction
extends MathFunction
A class that constructs a piecewise linear function passing through a specified set of points.

Version:
1.0
Author:
Joe Yanik
Since:
6/4/2001

Variable Index

 o points
The Vector that will contain the points used to define the function.

Constructor Index

 o EDU.emporia.mathtools.PiecewiseLinearFunction()
 o EDU.emporia.mathtools.PiecewiseLinearFunction(Point2D.Double[])

Method Index

 o addPoint(Point2D.Double)
Adds the indicated point to the list of points used to construct the function.
 o addPoint(double, double)
Adds the point with the specified x and y coordinate.
 o addPoints(Point2D.Double[])
Adds the indicate array of points to the ones that are being used to define the function.
 o functionValue(double)
Overrides the functionValue method of the MathFunction class.
 o getPoints()
Gets the array of points that are being used to define the function.
 o removeAllPoints()
Removes all points from the list of points that are used to define the function.
 o removePoint(Point2D.Double)
Removes the indicated point from the list of points that are being used to define the function
 o removePoint(double, double)
Removes the point with the indicated x and y coordinate from the list of points that are used to define the functoin
 o removePoint()
Removes the point with the largest x coordinate

Variables

 o points
protected java.util.Vector points
The Vector that will contain the points used to define the function. They will always be listed in increasing order of x-value.

Constructors

 o PiecewiseLinearFunction
public PiecewiseLinearFunction()
 o PiecewiseLinearFunction
public PiecewiseLinearFunction(EDU.emporia.mathtools.Point2D.Double[] p)

Methods

 o addPoint
public void addPoint(EDU.emporia.mathtools.Point2D.Double p) throws IllegalPointError
Adds the indicated point to the list of points used to construct the function. The function will then pass through the specified point. It will through an exception if there is already a point with that x-coordinate.

Parameters:
p - The point to be added.
Throws: IllegalPointError
 o addPoint
public void addPoint(double x,
                     double y) throws IllegalPointError
Adds the point with the specified x and y coordinate. It throws an IllegalPointError if there is already a point with the given x-coordinate.

Parameters:
x - The x-coordinate of the point to be added
y - The y-coordinate of the point to be added.
Throws: IllegalPointError
This will be thrown is there is an attempt to add a point with the same x coordinate as one that is already being used.
 o addPoints
public void addPoints(EDU.emporia.mathtools.Point2D.Double[] p) throws IllegalPointError
Adds the indicate array of points to the ones that are being used to define the function. If any of the points contains an x-value that is already being used it will throw and IllegalPointError.

Parameters:
p - The array of points to be added.
Throws: IllegalPointError
Thrown is there is a duplicate x-value.
 o functionValue
public double functionValue(double u)
Overrides the functionValue method of the MathFunction class. This method returns the value of the function at the specified x-coordinate

Parameters:
u - The x-coordinate
Returns:
f(x)
Overrides:
functionValue in class MathFunction
 o getPoints
public EDU.emporia.mathtools.Point2D.Double[] getPoints()
Gets the array of points that are being used to define the function.

Returns:
The array of points
 o removeAllPoints
public void removeAllPoints()
Removes all points from the list of points that are used to define the function.

 o removePoint
public void removePoint(EDU.emporia.mathtools.Point2D.Double p)
Removes the indicated point from the list of points that are being used to define the function

Parameters:
p - The point to be removed.
 o removePoint
public void removePoint(double x,
                        double y)
Removes the point with the indicated x and y coordinate from the list of points that are used to define the functoin

Parameters:
x - The x-coordinate of the point to be removed.
y - The y-coordinate of the point to be removed.
 o removePoint
public void removePoint()
Removes the point with the largest x coordinate


All Packages  Class Hierarchy  This Package  Previous  Next  Index