Class NumberTickUnitSource

  • All Implemented Interfaces:
    java.io.Serializable, TickUnitSource

    public class NumberTickUnitSource
    extends java.lang.Object
    implements TickUnitSource, java.io.Serializable
    A tick unit source implementation that returns NumberTickUnit instances that are multiples of 1, 2 or 5 times some power of 10.
    Since:
    1.0.18
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      TickUnit getCeilingTickUnit​(double size)
      Returns the smallest tick unit available in the source that is greater than or equal to the specified size.
      TickUnit getCeilingTickUnit​(TickUnit unit)
      Returns the tick unit in the collection that is greater than or equal to (in size) the specified unit.
      TickUnit getLargerTickUnit​(TickUnit unit)
      Returns the smallest tick unit available in the source that is larger than unit or, if there is no larger unit, returns unit.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NumberTickUnitSource

        public NumberTickUnitSource​(boolean integers)
        Creates a new instance.
        Parameters:
        integers - show integers only.
      • NumberTickUnitSource

        public NumberTickUnitSource​(boolean integers,
                                    java.text.NumberFormat formatter)
        Creates a new instance.
        Parameters:
        integers - show integers only?
        formatter - a formatter for the axis tick labels (null permitted).
    • Method Detail

      • getLargerTickUnit

        public TickUnit getLargerTickUnit​(TickUnit unit)
        Description copied from interface: TickUnitSource
        Returns the smallest tick unit available in the source that is larger than unit or, if there is no larger unit, returns unit.
        Specified by:
        getLargerTickUnit in interface TickUnitSource
        Parameters:
        unit - the unit (null not permitted).
        Returns:
        A tick unit that is larger than the supplied unit.
      • getCeilingTickUnit

        public TickUnit getCeilingTickUnit​(double size)
        Description copied from interface: TickUnitSource
        Returns the smallest tick unit available in the source that is greater than or equal to the specified size. If there is no such tick unit, the method should return the largest available tick in the source.
        Specified by:
        getCeilingTickUnit in interface TickUnitSource
        Parameters:
        size - the size.
        Returns:
        A unit from the collection (never null).
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object