com.exponto.jstock
Class Series

java.lang.Object
  |
  +--com.exponto.jstock.Series
Direct Known Subclasses:
LogDataSeries

public class Series
extends java.lang.Object


Constructor Summary
Series()
          Creates new Serie
 
Method Summary
static double base(double dbl)
          Returns a double that are the base (what is the proper name???) value of dbl.
static double findSignificant(double dbl, int n)
          Returns a double that are the n most significant numbers of dbl.
static double roundToStepSize(double value, double stepSize)
          Calculates the distance between supportlines used in drawing graphs.
static double stepSize(double min, double max, int height)
          Calculates the distance between supportlines used in drawing graphs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Series

public Series()
Creates new Serie

Method Detail

base

public static double base(double dbl)
Returns a double that are the base (what is the proper name???) value of dbl. The function is: power10(round(log10(dbl)))

Parameters:
dbl - Input double
Returns:
Base value of double, e.g. (3.1467) returns 1, (0.314) returns 0.1.

findSignificant

public static double findSignificant(double dbl,
                                     int n)
Returns a double that are the n most significant numbers of dbl.

Parameters:
dbl - Input double
n - number of significant numbers to return
Returns:
The n most signifcant numbers of dbl. The number are always rounded down, so it is always lower or equal to dbl. E.g (3.1467, 3) will return 3.14 and (31467, 2) returns 31000. Internally the dbl is converted to long and the method may cause overflow with large numbers.

stepSize

public static double stepSize(double min,
                              double max,
                              int height)
Calculates the distance between supportlines used in drawing graphs. This method should be improved. See comments in source.

Parameters:
min - lowest value found in the dataseries
max - highest value found in the dataseries
Returns:
A double that is the distance between supportlines that are drawn i GraphFile.

roundToStepSize

public static double roundToStepSize(double value,
                                     double stepSize)
Calculates the distance between supportlines used in drawing graphs. This method should be improved. See comments in source.

Parameters:
value - Input value
stepSize - The stepSize
Returns:
A double that is the closest double value equal to n * value where n is an integer. The result is always lower than value.


Copyright © 2004 Kaare Ranum