Package uk.ac.starlink.ttools.plot
Class Rounder
- java.lang.Object
-
- uk.ac.starlink.ttools.plot.Rounder
-
public abstract class Rounder extends java.lang.Object
Provides round numbers. Static instances are provided for rounding numbers to be used in a linear or a logarithmic context.- Since:
- 18 Nov 2005
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Constructor Description Rounder()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract double
nextDown(double value)
Returns the next round number smaller than the given value.abstract double
nextUp(double value)
Returns the next round number larger than the given value.abstract double
round(double value)
Returns a round number near the given value.
-
-
-
Field Detail
-
LINEAR
public static final Rounder LINEAR
Number rounder for linear scaling. All values are >0.
-
LOG
public static final Rounder LOG
Number rounder for logarithmic scaling. All values are >1.
-
TIME_SECOND
public static final Rounder TIME_SECOND
Number rounder for time intervals in seconds. All values are >0.
-
-
Method Detail
-
round
public abstract double round(double value)
Returns a round number near the given value.- Parameters:
value
- input value- Returns:
- round number near
value
-
nextUp
public abstract double nextUp(double value)
Returns the next round number larger than the given value.- Parameters:
value
- input value- Returns:
- round number a bit larger than
value
-
nextDown
public abstract double nextDown(double value)
Returns the next round number smaller than the given value.- Returns:
- value input value
-
-