Class Rounder

java.lang.Object
uk.ac.starlink.ttools.plot.Rounder

public abstract class Rounder extends 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
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Rounder
    Number rounder for linear scaling.
    static final Rounder
    Number rounder for logarithmic scaling.
    static final Rounder
    Number rounder for time intervals in seconds.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • 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.
  • Constructor Details

    • Rounder

      public Rounder()
  • Method Details

    • 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