net.moioli.drawables
Class AbstractDrawableSuccession

java.lang.Object
  extended by net.moioli.drawables.AbstractDrawableSuccession
All Implemented Interfaces:
DrawableI, SuccessionI
Direct Known Subclasses:
ParsedSuccession

public abstract class AbstractDrawableSuccession
extends java.lang.Object
implements SuccessionI, DrawableI

A general succession implementation.

Version:
2005/10/5
Author:
Silvio Moioli

Constructor Summary
AbstractDrawableSuccession()
          Default constructor.
 
Method Summary
 void drawMe(GraphicsI g, Scale s, java.lang.Object c)
          Implements Drawable, making it possible to draw this object.
abstract  double f(int n)
          Calculates the series n a given n index.
 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 minY(double minX, double maxX)
          Returns the minimum y value that should be represented in the DefaultChart for this object to be drawn properly.
 double safeF(int n)
          Returns this.f(x), or NaN if an exception occured while computing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDrawableSuccession

public AbstractDrawableSuccession()
Default constructor.

Method Detail

f

public abstract double f(int n)
Calculates the series n a given n index.

Specified by:
f in interface SuccessionI
Parameters:
n - the series n index
Returns:
the series value
Throws:
java.lang.ArithmeticException - if math errors are encountered

safeF

public double safeF(int n)
Returns this.f(x), or NaN if an exception occured while computing.

Parameters:
n - the abscissa
Returns:
{an} or NaN

drawMe

public void drawMe(GraphicsI g,
                   Scale s,
                   java.lang.Object c)
Implements Drawable, making it possible to draw this object.

Specified by:
drawMe in interface DrawableI
Parameters:
g - the surface where this Axes will be drawn
s - the DefaultChart's Scale object
c - the color to be used for drawing

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)