Overview  Package   Class  Tree  Index 

be.lassi.lanbox.domain
Class Time

java.lang.Object
  extended by be.lassi.lanbox.domain.Time

public final class Time
extends java.lang.Object

Helper class with look-up table for encoded time values.


Field Summary
static Time FOREVER
          Constant for indefinite time.
static Time[] SMALL_TIMES
           
static Time TIME_0S
          Constant zero seconds.
static Time TIME_1S
          Constant 1 second.
static Time TIME_2S
          Constant 2 seconds.
static Time TIME_5S
          Constant 5 seconds.
 
Method Summary
static Time fromMillis(int millis)
          Gets the time instance which duration is the closest to given number of milli-seconds.
static Time get(int id)
          Gets the time at given index in the look-up table.
static Time get(java.lang.String searchString)
          Gets the time object for given textual representation.
 int getId()
          Gets the encoded value.
 int getMillis()
          Gets the time in milliseconds.
 java.lang.String getString()
          Gets the textual representation of the time.
static java.lang.String[] getStrings()
          Gets the textual representations of all times.
 int getTicks()
          Gets the number of ticks (20 ticks per second).
static Time largestSmallerThan(int millis)
          Gets the time instance which duration is the first smaller than given number of milli-seconds.
 Time plus(Time other)
           
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FOREVER

public static final Time FOREVER
Constant for indefinite time.


SMALL_TIMES

public static final Time[] SMALL_TIMES

TIME_0S

public static final Time TIME_0S
Constant zero seconds.


TIME_1S

public static final Time TIME_1S
Constant 1 second.


TIME_2S

public static final Time TIME_2S
Constant 2 seconds.


TIME_5S

public static final Time TIME_5S
Constant 5 seconds.

Method Detail

fromMillis

public static Time fromMillis(int millis)
Gets the time instance which duration is the closest to given number of milli-seconds.

Parameters:
millis -
Returns:

get

public static Time get(int id)
Gets the time at given index in the look-up table.

Parameters:
id - the index into the look-up table
Returns:
the time at given index

get

public static Time get(java.lang.String searchString)
Gets the time object for given textual representation.

Parameters:
searchString - the textual representation of the time
Returns:
the time object

getId

public int getId()
Gets the encoded value.

Returns:
the encoded value

getMillis

public int getMillis()
Gets the time in milliseconds.

Returns:
the time in milliseconds

getString

public java.lang.String getString()
Gets the textual representation of the time.

Returns:
the textual representation of the time

getStrings

public static java.lang.String[] getStrings()
Gets the textual representations of all times.

Returns:
textual representations of all times

getTicks

public int getTicks()
Gets the number of ticks (20 ticks per second).

Returns:
the number of ticks

largestSmallerThan

public static Time largestSmallerThan(int millis)
Gets the time instance which duration is the first smaller than given number of milli-seconds.

Parameters:
millis -
Returns:

plus

public Time plus(Time other)

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

Overview  Package   Class  Tree  Index 
Lighting Assistant 1.2