JIDE 3.5.15

com.jidesoft.scale
Class NumberScaleModel

java.lang.Object
  extended by com.jidesoft.scale.AbstractScaleModel<Integer>
      extended by com.jidesoft.scale.NumberScaleModel
All Implemented Interfaces:
ScaleModel<Integer>, Serializable

public class NumberScaleModel
extends AbstractScaleModel<Integer>

A simple integer numbers scale that ranges from 0 to 100.

See Also:
Serialized Form

Constructor Summary
NumberScaleModel()
           
NumberScaleModel(int start, int end, NumberPeriod... periods)
           
 
Method Summary
 Integer getInstantAt(long position)
          Maps the position to a instant on the scale.
 Integer getPeriodEnd(Period period, Integer instant)
          This method returns the end of period in which the instant falls, which is the start instant of the next period.
 Integer getPeriodStart(Period period, Integer instant)
           
 long getPosition(Integer instant)
          Maps the unit to a long so it can be gives a position in the UI.
 
Methods inherited from class com.jidesoft.scale.AbstractScaleModel
getDefaultEnd, getDefaultStart, getPeriodBoundaries, getPeriods
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumberScaleModel

public NumberScaleModel()

NumberScaleModel

public NumberScaleModel(int start,
                        int end,
                        NumberPeriod... periods)
Method Detail

getInstantAt

public Integer getInstantAt(long position)
Description copied from interface: ScaleModel
Maps the position to a instant on the scale.

Parameters:
position - The position to get the instant for.
Returns:
the instant at the specified position on the scale.

getPeriodEnd

public Integer getPeriodEnd(Period period,
                            Integer instant)
Description copied from interface: ScaleModel
This method returns the end of period in which the instant falls, which is the start instant of the next period. This means that calling getPeriodStart on a periodEnd should return the same instant.
T periodEnd = getPeriodsEnd(period, instant);
 assertTrue(periodEnd == getPeriodStart(period, periodEnd));

Parameters:
period - A period which was returned from getPeriods().
instant - The instant to get the period end for.
Returns:
the instant on or after the specified instant which marks a end of the specified period type.

getPeriodStart

public Integer getPeriodStart(Period period,
                              Integer instant)
Parameters:
period - A period which was returned from getPeriods().
instant - The instant to get the period start for.
Returns:
the instant on or before the specified instant which marks a start of the specified period type.

getPosition

public long getPosition(Integer instant)
Description copied from interface: ScaleModel
Maps the unit to a long so it can be gives a position in the UI.

Parameters:
instant - The instant to get the position for.
Returns:
the position of the instant on the scale.

JIDE 3.5.15