Scala Monitoring and Control System API
com.lafros.macs.util

class Timer

[source: com/lafros/macs/util/Timer.scala]

class Timer(__params : Params)
extends AnyRef
timer which defines a cycle--in terms of its period and some reference boundary--and which is able to sleep until the next boundary of that cycle. This is NOT thread safe.
Author
Rob Dickens
Additional Constructor Summary
def this : Timer
creates new instance. The reference boundary will be set to 'the epoch'--0000 hours on 1970-01-01--and period to 1 second.
def this (refBoundaryMillis : Long, periodMillis : Long) : Timer
creates new instance.
Method Summary
def lagMillis : Long
where (current time + lagMillis) is used in place of the value obtained from the system clock.
def lagMillis_= (lagMillis : Long) : Unit
def lastBoundaryMillis : Long
in case sleep not called.
def params : Params
parameters.
def params_= (params : Params) : Unit
def periodMillis : Long
period parameter/ms.
def periodMillis_= (periodMillis : Long) : Unit
def setParams (refBoundaryMillis : Long, periodMillis : Long) : Unit
convenience.
def setRefBoundaryMillis (refBoundaryMillis : Long) : Unit
sets new reference boundary/ms.
def sleep : Long
until next boundary.
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Additional Constructor Details
def this(refBoundaryMillis : Long, periodMillis : Long) : Timer
creates new instance.

def this : Timer
creates new instance. The reference boundary will be set to 'the epoch'--0000 hours on 1970-01-01--and period to 1 second.

Method Details
def params : Params
parameters.

def params_=(params : Params) : Unit

def periodMillis : Long
period parameter/ms.

def periodMillis_=(periodMillis : Long) : Unit

def lagMillis : Long
where (current time + lagMillis) is used in place of the value obtained from the system clock.

def lagMillis_=(lagMillis : Long) : Unit

def sleep : Long
until next boundary.
Returns
time of boundary (when woke up)

def lastBoundaryMillis : Long
in case sleep not called.

def setRefBoundaryMillis(refBoundaryMillis : Long) : Unit
sets new reference boundary/ms.

def setParams(refBoundaryMillis : Long, periodMillis : Long) : Unit
convenience.


Copyright 2009 Latterfrosken Software Development Limited