unsw.cse.mica.tools.timer
Class TimerUtils

java.lang.Object
  extended by unsw.cse.mica.tools.timer.TimerUtils

public class TimerUtils
extends java.lang.Object

Contains some constants and utility functions that are used by the Timer and its supporting classes, primarily the TimerAgent.

Author:
jhw

Field Summary
static java.lang.String SLOT_absoluteTime
           
static java.lang.String SLOT_creationTime
           
static java.lang.String SLOT_creator
           
static java.lang.String SLOT_eventName
           
static java.lang.String SLOT_eventTime
           
static java.lang.String SLOT_eventType
           
static java.lang.String SLOT_numEvents
           
static java.lang.String SLOT_period
           
static java.lang.String SLOT_relativeTime
           
static java.lang.String TYPE_timerCancel
          The timerCancel Mob type.
static java.lang.String TYPE_timerEvent
          The default mob type for TimerEvents
static java.lang.String TYPE_timerRequest
          The timerRequest Mob type.
 
Constructor Summary
TimerUtils()
           
 
Method Summary
static Mob createAbsoluteRequestMob(java.lang.String type, java.lang.String name, java.sql.Timestamp absoluteTime)
          Helper function to simplify timerRequest Mob creation for a one-off event with an absolute time.
static Mob createCancelMob(java.util.List names)
          Helper function to simplify timerCancel Mob creation
static Mob createCancelMob(java.lang.String name)
          Helper function to simplify timerCancel Mob creation.
static TimerEvent createEvent(Mob mob)
          Helper function to create an event from a Mob
static Mob createMob(TimerEvent event)
          Helper function to create a Mob from an Event.
static Mob createPeriodRequestMob(java.lang.String type, java.lang.String name, long period, int numEvents)
          Helper function to simplify timerRequest Mob creation for a recurring event starting immediately.
static Mob createRelativeRequestMob(java.lang.String type, java.lang.String name, long relativeTime)
          Helper function to simplify timerRequest Mob creation for a one-off event with a relative time (expressed in millseconds from now)
static java.lang.String getTimeString()
          Return a String representation of the current time (in the form HH:MM:SS.ms)
static java.lang.String getTimeString(long time)
          Return a String representation of the given time (in the form HH:MM:SS.ms)
static boolean isReservedSlotName(java.lang.String str)
          See if a given slot name is a reserved name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_timerRequest

public static final java.lang.String TYPE_timerRequest
The timerRequest Mob type. Mobs of this type contain information used to create TimerEvents

See Also:
Constant Field Values

TYPE_timerCancel

public static final java.lang.String TYPE_timerCancel
The timerCancel Mob type. Mobas of this type contain information used to cancel timerEvents

See Also:
Constant Field Values

TYPE_timerEvent

public static final java.lang.String TYPE_timerEvent
The default mob type for TimerEvents

See Also:
Constant Field Values

SLOT_creator

public static final java.lang.String SLOT_creator
See Also:
Constant Field Values

SLOT_creationTime

public static final java.lang.String SLOT_creationTime
See Also:
Constant Field Values

SLOT_eventName

public static final java.lang.String SLOT_eventName
See Also:
Constant Field Values

SLOT_eventType

public static final java.lang.String SLOT_eventType
See Also:
Constant Field Values

SLOT_eventTime

public static final java.lang.String SLOT_eventTime
See Also:
Constant Field Values

SLOT_absoluteTime

public static final java.lang.String SLOT_absoluteTime
See Also:
Constant Field Values

SLOT_relativeTime

public static final java.lang.String SLOT_relativeTime
See Also:
Constant Field Values

SLOT_period

public static final java.lang.String SLOT_period
See Also:
Constant Field Values

SLOT_numEvents

public static final java.lang.String SLOT_numEvents
See Also:
Constant Field Values
Constructor Detail

TimerUtils

public TimerUtils()
Method Detail

isReservedSlotName

public static final boolean isReservedSlotName(java.lang.String str)
See if a given slot name is a reserved name. Any slt with a non-reserved name is assumed to be generic data is as added as a data slot to a Mob/Event rather than being processed in any specific way.

Parameters:
str -

getTimeString

public static java.lang.String getTimeString()
Return a String representation of the current time (in the form HH:MM:SS.ms)


getTimeString

public static java.lang.String getTimeString(long time)
Return a String representation of the given time (in the form HH:MM:SS.ms)


createRelativeRequestMob

public static final Mob createRelativeRequestMob(java.lang.String type,
                                                 java.lang.String name,
                                                 long relativeTime)
Helper function to simplify timerRequest Mob creation for a one-off event with a relative time (expressed in millseconds from now)

Parameters:
type -
name -
relativeTime -

createAbsoluteRequestMob

public static final Mob createAbsoluteRequestMob(java.lang.String type,
                                                 java.lang.String name,
                                                 java.sql.Timestamp absoluteTime)
Helper function to simplify timerRequest Mob creation for a one-off event with an absolute time.

Parameters:
type -
name -
absoluteTime -

createPeriodRequestMob

public static final Mob createPeriodRequestMob(java.lang.String type,
                                               java.lang.String name,
                                               long period,
                                               int numEvents)
Helper function to simplify timerRequest Mob creation for a recurring event starting immediately.

Parameters:
type -
name -
period -
numEvents -

createCancelMob

public static final Mob createCancelMob(java.lang.String name)
Helper function to simplify timerCancel Mob creation.

Parameters:
name -

createCancelMob

public static final Mob createCancelMob(java.util.List names)
Helper function to simplify timerCancel Mob creation

Parameters:
names -

createEvent

public static TimerEvent createEvent(Mob mob)
Helper function to create an event from a Mob

Parameters:
mob -

createMob

public static Mob createMob(TimerEvent event)
Helper function to create a Mob from an Event.

Parameters:
event -