JACK 5.4 Application Interface

aos.jack.jak.util.timer
Class DilatedClock

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

public class DilatedClock
extends BaseClock
implements Timer, TimerClient

A timer filter that provides time dilation. It can allow time to pass at normal pace, but it can also slow down, speed up or pause time if required.


Constructor Summary
DilatedClock(double d, Timer t)
          Constructs a DilatedClock with given initial dilation factor and source timer.
DilatedClock(java.lang.String s, double d, Timer t)
          Constructs a DilatedClock with given name, initial dilation factor and source timer.
 
Method Summary
 long adjustTime(long t)
          Advances dilated time.
 void expired(TimerHandle h, java.lang.Object o)
           
 double getDilation()
          Gets current dilation factor.
 long getTime()
          Returns dilated timer reading.
 void go()
          Continues the dilated time.
 boolean isRunning()
          Tells whether the dilated time is running or not.
protected  void reschedule()
           
 void setController(TimerClient c)
          Sets new controller for this DilatedClock.
 void setDilation(double d)
          Changes dilation factor.
 void setTime(long t)
          Changes dilated time.
 void stop()
          Stops the dilated 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

DilatedClock

public DilatedClock(double d,
                    Timer t)
Constructs a DilatedClock with given initial dilation factor and source timer.

Parameters:
d - The dilation factor.
t - The Timer what will be used to specify this clock.

DilatedClock

public DilatedClock(java.lang.String s,
                    double d,
                    Timer t)
Constructs a DilatedClock with given name, initial dilation factor and source timer.

Parameters:
s - The name for the clock.
d - The dilation factor.
t - The Timer that will be used to specify this clock.
Method Detail

getTime

public long getTime()
Returns dilated timer reading.

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

stop

public void stop()
Stops the dilated time.


go

public void go()
Continues the dilated time.


isRunning

public boolean isRunning()
Tells whether the dilated time is running or not.


setDilation

public void setDilation(double d)
Changes dilation factor.

Parameters:
d - The new dilation factor.

getDilation

public double getDilation()
Gets current dilation factor.


setController

public void setController(TimerClient c)
Sets new controller for this DilatedClock.


reschedule

protected void reschedule()
Specified by:
reschedule in class BaseClock

expired

public void expired(TimerHandle h,
                    java.lang.Object o)
Specified by:
expired in interface TimerClient

setTime

public void setTime(long t)
Changes dilated time.

Specified by:
setTime in interface Timer

adjustTime

public long adjustTime(long t)
Advances dilated time.

Specified by:
adjustTime in interface Timer

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