![]() | [using it] | Interface Manipulation Package v4.0 (2008-06-25) | ![]() | ©copyright | ![]() |
java.lang.Objectimp.util.Event.AbstractSender<String>
imp.util.Sampler
public abstract class Sampler
Defines the implementation of a periodic task.
Nested Class Summary | |
---|---|
static interface |
Sampler.Listener
Defines a start/stop/pause/resume event listener. |
Constructor Summary | |
---|---|
Sampler()
Constructs a sampler. |
Method Summary | |
---|---|
int |
getSpareTime()
Returns the spare-time between two samplings. |
abstract void |
iter()
Periodically called when the sampler is started. |
void |
resume(boolean resume)
Pauses/Resumes the iteration mechanism. |
void |
setSamplingPeriod(int samplingPeriod)
Sets the sampling period. |
void |
start(int samplingPeriod)
(Re)starts the sampling of the iter() method. |
void |
stop()
Requires the sampling of the iter() method to stop. |
Methods inherited from class imp.util.Event.AbstractSender |
---|
addListener, eventSent, removeListener |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Sampler()
Method Detail |
---|
public int getSpareTime()
RuntimeException
- if a runtime exception has occurred during sampling.public abstract void iter()
public void resume(boolean resume)
public void setSamplingPeriod(int samplingPeriod)
samplingPeriod
- A positive sampling-period in milliseconds.public void start(int samplingPeriod)
samplingPeriod
- [optional, default is 10ms or the previous sampling period] A positive sampling-period in milliseconds.public void stop()
RuntimeException
- if a runtime exception has occurred during sampling.