TUIO
Class TuioTime

java.lang.Object
  extended by TUIO.TuioTime

public class TuioTime
extends java.lang.Object

The TuioTime class is a simple structure that is used to reprent the time that has elapsed since the session start. The time is internally represented as seconds and fractions of microseconds which should be more than sufficient for gesture related timing requirements. Therefore at the beginning of a typical TUIO session the static method initSession() will set the reference time for the session. Another important static method getSessionTime will return a TuioTime object representing the time elapsed since the session start. The class also provides various addtional convience method, which allow some simple time arithmetics.


Constructor Summary
TuioTime()
          The default constructor takes no arguments and sets the Seconds and Microseconds attributes of the newly created TuioTime both to zero.
TuioTime(long msec)
          This constructor takes the provided time represented in total Milliseconds and assigs this value to the newly created TuioTime.
TuioTime(long sec, long usec)
          This constructor takes the provided time represented in Seconds and Microseconds and assigs these value to the newly created TuioTime.
TuioTime(TuioTime ttime)
          This constructor takes the provided TuioTime and assigs its Seconds and Microseconds values to the newly created TuioTime.
 
Method Summary
 TuioTime add(long us)
          Sums the provided time value represented in total Microseconds to this TuioTime.
 TuioTime add(TuioTime ttime)
          Sums the provided TuioTime to the private Seconds and Microseconds attributes.
 boolean equals(TuioTime ttime)
          Takes a TuioTime argument and compares the provided TuioTime to the private Seconds and Microseconds attributes.
 long getMicroseconds()
          Returns the TuioTime Microseconds component.
 long getSeconds()
          Returns the TuioTime Seconds component.
static TuioTime getSessionTime()
          Returns the present TuioTime representing the time since session start.
static TuioTime getStartTime()
          Returns the absolut TuioTime representing the session start.
static TuioTime getSystemTime()
          Returns the absolut TuioTime representing the current system time.
 long getTotalMilliseconds()
          Returns the total TuioTime in Milliseconds.
static void initSession()
          This static method globally resets the TUIO session time.
 void reset()
          Resets the seconds and micro_seconds attributes to zero.
 TuioTime subtract(long us)
          Subtracts the provided time represented in Microseconds from the private Seconds and Microseconds attributes.
 TuioTime subtract(TuioTime ttime)
          Subtracts the provided TuioTime from the private Seconds and Microseconds attributes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TuioTime

public TuioTime()
The default constructor takes no arguments and sets the Seconds and Microseconds attributes of the newly created TuioTime both to zero.


TuioTime

public TuioTime(long msec)
This constructor takes the provided time represented in total Milliseconds and assigs this value to the newly created TuioTime.

Parameters:
msec - the total time in Millseconds

TuioTime

public TuioTime(long sec,
                long usec)
This constructor takes the provided time represented in Seconds and Microseconds and assigs these value to the newly created TuioTime.

Parameters:
sec - the total time in seconds
usec - the microseconds time component

TuioTime

public TuioTime(TuioTime ttime)
This constructor takes the provided TuioTime and assigs its Seconds and Microseconds values to the newly created TuioTime.

Parameters:
ttime - the TuioTime used to copy
Method Detail

add

public TuioTime add(long us)
Sums the provided time value represented in total Microseconds to this TuioTime.

Parameters:
us - the total time to add in Microseconds
Returns:
the sum of this TuioTime with the provided argument in microseconds

add

public TuioTime add(TuioTime ttime)
Sums the provided TuioTime to the private Seconds and Microseconds attributes.

Parameters:
ttime - the TuioTime to add
Returns:
the sum of this TuioTime with the provided TuioTime argument

subtract

public TuioTime subtract(long us)
Subtracts the provided time represented in Microseconds from the private Seconds and Microseconds attributes.

Parameters:
us - the total time to subtract in Microseconds
Returns:
the subtraction result of this TuioTime minus the provided time in Microseconds

subtract

public TuioTime subtract(TuioTime ttime)
Subtracts the provided TuioTime from the private Seconds and Microseconds attributes.

Parameters:
ttime - the TuioTime to subtract
Returns:
the subtraction result of this TuioTime minus the provided TuioTime

equals

public boolean equals(TuioTime ttime)
Takes a TuioTime argument and compares the provided TuioTime to the private Seconds and Microseconds attributes.

Parameters:
ttime - the TuioTime to compare
Returns:
true if the two TuioTime have equal Seconds and Microseconds attributes

reset

public void reset()
Resets the seconds and micro_seconds attributes to zero.


getSeconds

public long getSeconds()
Returns the TuioTime Seconds component.

Returns:
the TuioTime Seconds component

getMicroseconds

public long getMicroseconds()
Returns the TuioTime Microseconds component.

Returns:
the TuioTime Microseconds component

getTotalMilliseconds

public long getTotalMilliseconds()
Returns the total TuioTime in Milliseconds.

Returns:
the total TuioTime in Milliseconds

initSession

public static void initSession()
This static method globally resets the TUIO session time.


getSessionTime

public static TuioTime getSessionTime()
Returns the present TuioTime representing the time since session start.

Returns:
the present TuioTime representing the time since session start

getStartTime

public static TuioTime getStartTime()
Returns the absolut TuioTime representing the session start.

Returns:
the absolut TuioTime representing the session start

getSystemTime

public static TuioTime getSystemTime()
Returns the absolut TuioTime representing the current system time.

Returns:
the absolut TuioTime representing the current system time