public class Metronome
extends java.lang.Object
This class follows DbC(tm) methodology
(Wikipedia).
Where possible, contracts are implement with native's Java
assert.
Constructor and Description |
---|
Metronome(long clockPeriod)
Constructs a new metronome with a specified time period.
|
Modifier and Type | Method and Description |
---|---|
boolean |
active()
Is current metronome still active?
|
long |
sync()
Caller will wait until the next metronome tick.
|
void |
terminate()
Terminate current metronome.
|
public Metronome(long clockPeriod)
clockPeriod > 0L
clockPeriod
- the metronome's period in millisecondspublic boolean active()
public long sync()
public void terminate()
!active()