Class dpscomponents.RoundedDouble
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class dpscomponents.RoundedDouble

java.lang.Object
   |
   +----dpscomponents.RoundedDouble

public class RoundedDouble
extends Object
This class just puts a little more framework around the number formatting apparatus developed for use with sliders. Add a few bells and whistles...
Version:
1.1 04-07-97
Author:
Daren Stotler
See Also:
RoundedDoubleTest

Constructor Index

 o RoundedDouble(double)
Simplest constructor.
 o RoundedDouble(double, int)
Complete constructor.

Method Index

 o setPrecision(int)
Allows the precision of the floating point number to be altered.
 o toDouble()
The nicely formatted string of previously specified precision is returned as a double.
 o toString()
The principal reason for the existence of this class is to generate nicely formatted fixed point numbers.

Constructors

 o RoundedDouble
  public RoundedDouble(double x)
Simplest constructor.
Parameters:
x - double which will be rounded.
 o RoundedDouble
  public RoundedDouble(double x,
                       int n)
Complete constructor.
Parameters:
x - double which will be rounded.
n - number of digits to the right of the decimal.

Methods

 o toString
  public String toString()
The principal reason for the existence of this class is to generate nicely formatted fixed point numbers. This method provides the string that's needed.
Returns:
string corresponding to the rounded double.
Overrides:
toString in class Object
 o setPrecision
  public void setPrecision(int p)
Allows the precision of the floating point number to be altered. Since the original double value is not changed, this can be increased or decreased as needed.
Parameters:
p - number of digits to the right of the decimal.
 o toDouble
  public double toDouble()
The nicely formatted string of previously specified precision is returned as a double.
Returns:
double rounded off to a specified precision.

All Packages  Class Hierarchy  This Package  Previous  Next  Index