|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread sky.monome.util.ThreadWithUserObjects
public abstract class ThreadWithUserObjects
Thread which can have user objects for use by example in the run()
method.
Implementors of this class must redefine the run()
method.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
protected java.lang.Object[] |
userObjects
Array of arguments given to this thread. |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
ThreadWithUserObjects(java.lang.Object... userObjects)
Constructs a thread with given user objects. |
|
ThreadWithUserObjects(java.lang.String name,
java.lang.Object... userObjects)
Constructs a thread with given user objects and the specified name. |
|
ThreadWithUserObjects(java.lang.ThreadGroup threadGroup,
java.lang.String name,
java.lang.Object... userObjects)
Constructs a thread with given user objects, the specified thread group and the specified name. |
Method Summary | ||
---|---|---|
|
getUserObject(java.lang.Class<T> clazz,
int index)
Returns the user object at the specified index in the array of user objects. |
|
|
getUserObject(int index)
Returns the user object at the specified index in the array of user objects. |
|
abstract void |
run()
Contains the main action of this thread. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final java.lang.Object[] userObjects
Constructor Detail |
---|
public ThreadWithUserObjects(java.lang.Object... userObjects)
userObjects
- User objects that can be used by example in the run()
method.public ThreadWithUserObjects(java.lang.String name, java.lang.Object... userObjects)
name
- Name of this thread.userObjects
- User objects that can be used by example in the run()
method.public ThreadWithUserObjects(java.lang.ThreadGroup threadGroup, java.lang.String name, java.lang.Object... userObjects)
threadGroup
- Thread group into which this thread will be executed.name
- Name of this thread.userObjects
- User objects that can be used by example in the run()
method.Method Detail |
---|
public <T> T getUserObject(int index)
T
- Type of the returned user object.index
- Index of the user object in the array of user objects.
java.lang.ArrayIndexOutOfBoundsException
- When the index is not valid for the array of user objects.
java.lang.ClassCastException
- When the user object can't be typed to the specified type.public <T> T getUserObject(java.lang.Class<T> clazz, int index)
T
- Type of the returned user object.clazz
- Class object which indicates the type of the returned user object.index
- Index of the user object in the array of user objects.
java.lang.ArrayIndexOutOfBoundsException
- When the index is not valid for the array of user objects.
java.lang.ClassCastException
- When the user object can't be typed to the specified type.public abstract void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |