public abstract class Command
extends java.lang.Object
implements java.lang.Runnable
| Constructor and Description |
|---|
Command()
Creates a new
Command. |
| Modifier and Type | Method and Description |
|---|---|
void |
forceStop() |
abstract boolean |
isFinished()
User-implemented method to check if
onLoop should stop executing. |
boolean |
isRunning()
Checks if this Command is currently running.
|
abstract void |
onInit()
Runs once every time this
Command is started. |
abstract void |
onLoop()
Runs continuously until
isFinished returns true. |
abstract void |
onStop()
Runs once when
isFinished returns true and onLoop finishes. |
void |
run()
Manages the lifecycle of this
Command |
void |
start()
Called to start the
Command |
void |
stop()
Forces this Command to stop running.
|
void |
waitTillFinished()
Blocks until the command has finished execution.
|
public void start()
Commandpublic void waitTillFinished()
onStop
method has returned.public boolean isRunning()
public void stop()
public void forceStop()
public abstract void onInit()
Command is started.public abstract void onLoop()
isFinished returns true. Is not guaranteed to run.public abstract void onStop()
isFinished returns true and onLoop finishes.public abstract boolean isFinished()
onLoop should stop executing.onLoop should onStop executingpublic void run()
Commandrun in interface java.lang.Runnable