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
-
points
- The Vector that will contain the points used to define the function.
-
EDU.emporia.mathtools.PiecewiseLinearFunction()
-
-
EDU.emporia.mathtools.PiecewiseLinearFunction(Point2D.Double[])
-
-
addPoint(Point2D.Double)
- Adds the indicated point to the list of points used to construct the function.
-
addPoint(double, double)
- Adds the point with the specified x and y coordinate.
-
addPoints(Point2D.Double[])
- Adds the indicate array of points to the ones that are being used to define the
function.
-
functionValue(double)
- Overrides the functionValue method of the MathFunction class.
-
getPoints()
- Gets the array of points that are being used to define the function.
-
removeAllPoints()
- Removes all points from the list of points that are used to define the function.
-
removePoint(Point2D.Double)
- Removes the indicated point from the list of points that are being used to
define the function
-
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
-
removePoint()
- Removes the point with the largest x coordinate
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.
PiecewiseLinearFunction
public PiecewiseLinearFunction()
PiecewiseLinearFunction
public PiecewiseLinearFunction(EDU.emporia.mathtools.Point2D.Double[] p)
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
-
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.
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.
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
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
removeAllPoints
public void removeAllPoints()
- Removes all points from the list of points that are used to define the function.
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.
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.
removePoint
public void removePoint()
- Removes the point with the largest x coordinate
All Packages Class Hierarchy This Package Previous Next Index