Package org.pepstock.charba.client.utils
Class CTimer
- java.lang.Object
-
- org.pepstock.charba.client.utils.CTimer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CTimer.Status
Enumerates the possible status of the timer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getInterval()
Returns the time, in milliseconds (thousands of a second), the timer should delay in between executions of the specified task.CTimer.Status
getStatus()
Returns the status of the timer.void
start()
Starts the timer which executes repeatedly calls.void
start(int interval)
Starts the timer which executes repeatedly calls, setting the time, in milliseconds (thousands of a second), the timer should delay in between executions of the specified task.
The time will override the previous interval time.void
stop()
Stops the timer which is currently running.
-
-
-
Constructor Detail
-
CTimer
public CTimer(Runnable task, int interval)
Creates the timer with aRunnable
to be executed repeatedly and the time, in milliseconds (thousands of a second), the timer should delay in between executions of the task.- Parameters:
task
- the task to be executed repeatedlyinterval
- the time, in milliseconds (thousands of a second), the timer should delay in between executions of the specified task.
Must be greater than 0.
-
-
Method Detail
-
getInterval
public int getInterval()
Returns the time, in milliseconds (thousands of a second), the timer should delay in between executions of the specified task.- Returns:
- the time, in milliseconds (thousands of a second), the timer should delay in between executions of the specified task
-
getStatus
public CTimer.Status getStatus()
Returns the status of the timer.- Returns:
- the status of the timer
-
start
public void start(int interval)
Starts the timer which executes repeatedly calls, setting the time, in milliseconds (thousands of a second), the timer should delay in between executions of the specified task.
The time will override the previous interval time.- Parameters:
interval
- the time, in milliseconds (thousands of a second), the timer should delay in between executions of the specified task.
Must be greater than 0.
-
start
public void start()
Starts the timer which executes repeatedly calls.
-
stop
public void stop()
Stops the timer which is currently running.
-
-