public abstract class SimpleRunnable
extends java.lang.Object
implements java.lang.Runnable
Modifier and Type | Field and Description |
---|---|
static boolean |
RESTRICT_THREAD_USAGE |
Constructor and Description |
---|
SimpleRunnable() |
Modifier and Type | Method and Description |
---|---|
void |
delay(int delay)
Delays the given thread from running
|
void |
disable(boolean clean)
Disables this thread from running
|
void |
enable()
Attempts to reenable this thread
|
boolean |
equals(java.lang.Object other) |
java.lang.String |
getName()
Gets the name of the thread
|
boolean |
isCleaned()
Gets whether is runnable is cleaned
|
boolean |
isEnabled()
Gets whether the runnable is running
|
abstract void |
run()
Called by the thread to run this runnable
|
void |
setTicking(long delay)
Makes the thread loop every x milliseconds
|
void |
start()
Runs a thread with this runnable
|
java.lang.String |
toString() |
public final void disable(boolean clean) throws java.lang.IllegalThreadStateException
clean
- Whether to clean the thread running - This will prevent this runnable from being able to run, only cleans if enabled in the configjava.lang.IllegalThreadStateException
public final void enable() throws java.lang.IllegalThreadStateException
java.lang.IllegalThreadStateException
public final void start()
public abstract void run()
run
in interface java.lang.Runnable
public java.lang.String getName()
public final void delay(int delay) throws java.lang.InterruptedException
delay
- The length of the delay (in milliseconds)java.lang.InterruptedException
public boolean isCleaned()
public boolean isEnabled()
public void setTicking(long delay)
delay
- The delay for each loop, in millisecondspublic boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object