com.bbn.openmap.time
Class TimeEvent

java.lang.Object
  extended by com.bbn.openmap.time.TimeEvent
All Implemented Interfaces:
java.io.Serializable

public class TimeEvent
extends java.lang.Object
implements java.io.Serializable

The heartbeat of the application that indicates what the current display time is, for all other components to react to. It might reflect the current system time, or the time that should be reflected in some recording playback.

Author:
dietrick
See Also:
Serialized Form

Field Summary
static TimeEvent NO_TIME
           
protected  long offsetTime
          The current offset time, in millis from the start of the time frame of interest.
protected  long simTime
          The current simulation time, if the current system time does not correspond to the time frame of the data.
protected  java.lang.Object source
          The source of the TimeEvent.
protected  long systemTime
          The current system time, millis from unix epoch.
protected  TimerStatus timerStatus
          Description of how/why time changed.
 
Constructor Summary
TimeEvent(java.lang.Object src, long systemTime, long offsetTime, long simTime, TimerStatus timerStatus)
          Create a time event.
 
Method Summary
static TimeEvent create(java.lang.Object src, long time, long systemTime, long simTime, TimerStatus timerStatus)
          Create a time event, with the option of receiving the NO_TIME event if the time is Long.MIN_VALUE and the system time and simulation time are Long.MAX_VALUE.
 long getOffsetTime()
           
 long getSimTime()
           
 java.lang.Object getSource()
           
 long getSystemTime()
           
 TimerStatus getTimerStatus()
          Returns the String identifying the timer action (TIMER_FORWARD, TIMER_STOPPED, TIMER_TIME_STATUS, ...).
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

source

protected java.lang.Object source
The source of the TimeEvent.


systemTime

protected long systemTime
The current system time, millis from unix epoch.


offsetTime

protected long offsetTime
The current offset time, in millis from the start of the time frame of interest.


simTime

protected long simTime
The current simulation time, if the current system time does not correspond to the time frame of the data.


timerStatus

protected TimerStatus timerStatus
Description of how/why time changed.


NO_TIME

public static final TimeEvent NO_TIME
Constructor Detail

TimeEvent

public TimeEvent(java.lang.Object src,
                 long systemTime,
                 long offsetTime,
                 long simTime,
                 TimerStatus timerStatus)
Create a time event.

Parameters:
src - the object creating the time event.
systemTime - the current system time, millis from the epoch.
offsetTime - the current offset time, in millis from the start of the mission or media.
simTime - the current simulation time, in millis from the start of the simulation clock.
timerStatus -
Method Detail

create

public static TimeEvent create(java.lang.Object src,
                               long time,
                               long systemTime,
                               long simTime,
                               TimerStatus timerStatus)
Create a time event, with the option of receiving the NO_TIME event if the time is Long.MIN_VALUE and the system time and simulation time are Long.MAX_VALUE.

Parameters:
src - the object creating the time event.
time - the current time of the clock, millis from the epoch.
systemTime - the time of the start of the media, in millis from epoch. Subtracted from the time, it should give the offset time from the start of the mission or media.
simTime - the starting time within the simulation of the currently active mission or media, in millis. When the offset time (time - system time) is added to this time, you should have the current game time.
timerStatus - to describe what kind of TimeEvent should be created.
Returns:
a TimeEvent, or TimeEvent.NO_TIME object if the time values indicate that no time has been set on the clock.

getSource

public java.lang.Object getSource()

getSystemTime

public long getSystemTime()

getOffsetTime

public long getOffsetTime()

getSimTime

public long getSimTime()

getTimerStatus

public TimerStatus getTimerStatus()
Returns the String identifying the timer action (TIMER_FORWARD, TIMER_STOPPED, TIMER_TIME_STATUS, ...).

Returns:
String identifying what's going on with the timer.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details