public class AutomatonManager
extends java.lang.Object
It can be started immediately or after a period of inactivity.
Constructor and Description |
---|
AutomatonManager(Automaton automaton,
long delay)
Creates an automaton manager for an Automaton with a
SimpleWatchdog feeds by all Events. |
AutomatonManager(Automaton automaton,
long delay,
Timer timer)
Creates an automaton manager for an Automaton with a
SimpleWatchdog feeds by all Events. |
Modifier and Type | Method and Description |
---|---|
void |
arm()
Starts the automaton.
|
Watchdog |
getWatchdog()
Returns the watchdog of this automaton manager.
|
void |
setAutomaton(Automaton automaton)
Sets the automaton.
|
void |
setWatchdog(Watchdog watchdog)
Sets a watchdog.
|
void |
stop()
Stops the automaton.
|
public AutomatonManager(Automaton automaton, long delay)
SimpleWatchdog
feeds by all Events.automaton
- the automaton.delay
- the delay before triggering the Automaton.java.lang.NullPointerException
- if the given automaton is null
.public AutomatonManager(Automaton automaton, long delay, Timer timer)
SimpleWatchdog
feeds by all Events.automaton
- the automaton.delay
- the delay before triggering the Automaton.timer
- the timer.java.lang.NullPointerException
- if the given automaton or timer is null
.public void setWatchdog(Watchdog watchdog)
If the given watchdog is set, the automaton is started as soon as arm()
method is called.
watchdog
- the watchdog.public Watchdog getWatchdog()
null
if not defined.public void setAutomaton(Automaton automaton)
automaton
- the automaton.java.lang.NullPointerException
- if the given automaton is null
.public void arm()
If a watchdog is declared, the automaton is started after a period of inactivity, and stopped when an activity is detected.
Watchdog
public void stop()