net.moioli.drawables
Class AbstractPlaneCurve

java.lang.Object
  extended by net.moioli.drawables.AbstractPlaneCurve
All Implemented Interfaces:
DrawableI, PlaneCurveI
Direct Known Subclasses:
ParsedPlaneCurve

public abstract class AbstractPlaneCurve
extends java.lang.Object
implements PlaneCurveI, DrawableI

A general implementation of the DrawableI and PlaneCurveI interfaces. Includes empirical minY(), maxY(), minX() and maxX() methods.

Version:
2005/10/5
Author:
Silvio Moioli

Constructor Summary
AbstractPlaneCurve(double maxT)
          Default constructor, requires the maximum parameter value.
 
Method Summary
 void drawMe(GraphicsI g, Scale s, java.lang.Object c)
          This method is automatically called by DefaultChart to draw the objects it contains, so end users should never call drawMe directly.
 double getMaxT()
          Returns the maximum value the t parameter can assume.
 double getXMaximum()
          Returns the parameter value in which the function has an x maximum with an empirical algorithm.
 double getXMinimum()
          Returns the parameter value in which the function has an x minimum with an empirical algorithm.
 double getYMaximum()
          Returns the parameter value in which the function has an y maximum with an empirical algorithm.
 double getYMinimum()
          Returns the parameter value in which the function has an y minimum with an empirical algorithm.
 double maxX()
          Returns the minimum y value that the function takes.
 double maxY(double minX, double maxX)
          Returns the maximum y value that should be represented in the DefaultChart for this object to be drawn properly.
 double minX()
          Returns the minimum x value that the function takes.
 double minY(double minX, double maxX)
          Returns the minimum y value that should be represented in the DefaultChart for this object to be drawn properly.
 void setMaxT(double t)
          Sets the maximum value the t parameter can assume.
abstract  double x(double t)
          Returns the x value corresponding to the specified t (any point in this function has coordinates (x(t),y(t)).
abstract  double y(double t)
          Returns the y value corresponding to the specified t (any point in this function has coordinates (x(t),y(t)).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractPlaneCurve

public AbstractPlaneCurve(double maxT)
Default constructor, requires the maximum parameter value.

Parameters:
maxT - the maximum parameter value
Method Detail

getMaxT

public double getMaxT()
Description copied from interface: PlaneCurveI
Returns the maximum value the t parameter can assume.

Specified by:
getMaxT in interface PlaneCurveI
Returns:
the maximum t value
See Also:
PlaneCurveI.getMaxT()

setMaxT

public void setMaxT(double t)
Description copied from interface: PlaneCurveI
Sets the maximum value the t parameter can assume.

Specified by:
setMaxT in interface PlaneCurveI
Parameters:
t - the maximum t value
See Also:
PlaneCurveI.setMaxT(double t)

x

public abstract double x(double t)
Description copied from interface: PlaneCurveI
Returns the x value corresponding to the specified t (any point in this function has coordinates (x(t),y(t)).

Specified by:
x in interface PlaneCurveI
Parameters:
t - the parameter's value
Returns:
the point's abscissa
See Also:
PlaneCurveI.x(double t)

y

public abstract double y(double t)
Description copied from interface: PlaneCurveI
Returns the y value corresponding to the specified t (any point in this function has coordinates (x(t),y(t)).

Specified by:
y in interface PlaneCurveI
Parameters:
t - the parameter's value
Returns:
the point's ordinate
See Also:
PlaneCurveI.y(double t)

getXMinimum

public double getXMinimum()
Returns the parameter value in which the function has an x minimum with an empirical algorithm. While this method is accurate enough in most cases, it should be overridden whenever possible.

Returns:
the parameter value in which the function has an x minimum

getXMaximum

public double getXMaximum()
Returns the parameter value in which the function has an x maximum with an empirical algorithm. While this method is accurate enough in most cases, it should be overridden whenever possible.

Returns:
the parameter value in which the function has an x maximum

getYMinimum

public double getYMinimum()
Returns the parameter value in which the function has an y minimum with an empirical algorithm. While this method is accurate enough in most cases, it should be overridden whenever possible.

Returns:
the parameter value in which the function has an y minimum

getYMaximum

public double getYMaximum()
Returns the parameter value in which the function has an y maximum with an empirical algorithm. While this method is accurate enough in most cases, it should be overridden whenever possible.

Returns:
the parameter value in which the function has an y maximum

minX

public double minX()
Returns the minimum x value that the function takes.

Returns:
the minimum x

maxX

public double maxX()
Returns the minimum y value that the function takes.

Returns:
the minimum y

minY

public double minY(double minX,
                   double maxX)
Description copied from interface: DrawableI
Returns the minimum y value that should be represented in the DefaultChart for this object to be drawn properly.
If the object will be drawn indipendently from the y values represented in the DefaultChart, this method should return Double.NaN.

Specified by:
minY in interface DrawableI
Parameters:
minX - the minimum x value represented in this DefaultChart
maxX - the maximum x value represented in this DefaultChart
Returns:
the minimum y value or NaN
See Also:
DrawableI.minY(double, double)

maxY

public double maxY(double minX,
                   double maxX)
Description copied from interface: DrawableI
Returns the maximum y value that should be represented in the DefaultChart for this object to be drawn properly.
If the object will be drawn indipendently from the y values represented in the DefaultChart, this method should return Double.NaN.

Specified by:
maxY in interface DrawableI
Parameters:
minX - the minimum x value represented in this DefaultChart
maxX - the maximum x value represented in this DefaultChart
Returns:
the maximum y value or NaN
See Also:
DrawableI.maxY(double, double)

drawMe

public void drawMe(GraphicsI g,
                   Scale s,
                   java.lang.Object c)
Description copied from interface: DrawableI
This method is automatically called by DefaultChart to draw the objects it contains, so end users should never call drawMe directly. Inside this method there must be all the code to draw the object on a DefaultChart, and all the operations which involve scaling should be done via the passed Scale object.

Specified by:
drawMe in interface DrawableI
Parameters:
g - the surface where this object will be drawn
s - the DefaultChart's Scale object
c - the color to be used for drawing
See Also:
DrawableI.drawMe(GraphicsI g, Scale s, Object c)