JACK 5.4 Application Interface

aos.jack.jak.util.timer
Class SimClock

java.lang.Object
  extended byaos.util.timer.BaseClock
      extended byaos.jack.jak.util.timer.SimClock
All Implemented Interfaces:
Timer

public class SimClock
extends BaseClock
implements Timer

SimClock is a timer for simulation time. It is ticked manually. You can set and adjust the time but it will not advance by itself. Typically this is connected to some external time source which itself may or may not be connected to a real time source.


Constructor Summary
SimClock()
          Constructs a SimClock.
SimClock(java.lang.String s)
          Constructs a SimClock with a given name.
 
Method Summary
 long adjustTime(long t)
          Advances the timer by the given amount.
 long getTime()
          Gets timer value.
protected  void reschedule()
          This is called by setTime() and adjustTime() in order to notify any events that may be waiting on the clock that the time has advanced.
 void setTime(long t)
          Sets timer value to an absolute time.
 
Methods inherited from class aos.util.timer.BaseClock
cancel, dumpq, getName, getNextWhen, notifyExpired, schedule, schedule, scheduleAt, scheduleAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface aos.util.timer.Timer
cancel, getNextWhen, schedule, schedule, scheduleAt, scheduleAt
 

Constructor Detail

SimClock

public SimClock()
Constructs a SimClock.


SimClock

public SimClock(java.lang.String s)
Constructs a SimClock with a given name.

Parameters:
s - The name for the SimClock.
Method Detail

getTime

public long getTime()
Gets timer value.

Specified by:
getTime in interface Timer
Specified by:
getTime in class BaseClock

reschedule

protected void reschedule()
This is called by setTime() and adjustTime() in order to notify any events that may be waiting on the clock that the time has advanced.

Specified by:
reschedule in class BaseClock

setTime

public void setTime(long t)
Sets timer value to an absolute time. Note: forcing the time to go backwards will cause problems with event scheduling.

Specified by:
setTime in interface Timer
Parameters:
t - The new time for the SimClock.

adjustTime

public long adjustTime(long t)
Advances the timer by the given amount.

Specified by:
adjustTime in interface Timer
Parameters:
t - The number of ticks to advance the clock by.

JACK 5.4 Application Interface

Copyright (C) 1999-2008, Agent Oriented Software Pty. Ltd.

US Government Restricted Rights
The JACK Modules and relevant Software Material have been developed entirely at private expense and are accordingly provided with RESTRICTED RIGHTS. Use, duplication, or disclosure by Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of DFARS 252.227-7013 or subparagraph (c)(1) and (2) of the Commercial Computer Software Restricted Rights and 48 CFR 52.2270-19, as applicable.


Agent Oriented Software Pty. Ltd.     http://www.aosgrp.com
PO Box 639, Carlton South, Victoria 3053, Australia
Phone: +61 3 9349 5055, Fax: +61 3 9349 5088