|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectakka.contrib.pattern.WorkList<T>
public class WorkList<T>
Fast, small, and dirty implementation of a linked list that removes transient work entries once they are processed. The list is not thread safe! However it is expected to be reentrant. This means a processing function can add/remove entries from the list while processing. Most important, a processing function can remove its own entry from the list. The first remove must return true and any subsequent removes must return false.
Nested Class Summary | |
---|---|
static class |
WorkList.Entry<T>
Singly linked list entry implementation for WorkList. |
Constructor Summary | |
---|---|
WorkList()
|
Method Summary | ||
---|---|---|
WorkList<T> |
add(T ref,
boolean permanent)
Appends an entry to the work list. |
|
WorkList<T> |
addAll(WorkList<T> other)
Appends another WorkList to this WorkList. |
|
static
|
empty()
|
|
WorkList.Entry<T> |
head()
|
|
boolean |
process(scala.Function1<T,java.lang.Object> processFn)
Tries to process each entry using the processing function. |
|
boolean |
remove(T ref)
Removes an entry from the work list |
|
boolean |
removeAll()
Removes all entries from this WorkList |
|
WorkList.Entry<T> |
tail()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WorkList()
Method Detail |
---|
public static <T> WorkList<T> empty()
public WorkList.Entry<T> head()
public WorkList.Entry<T> tail()
public WorkList<T> add(T ref, boolean permanent)
ref
- The entry.permanent
- (undocumented)
public boolean remove(T ref)
ref
- The entry.
public boolean process(scala.Function1<T,java.lang.Object> processFn)
processFn
- The processing function, returns true if processing succeeds.
public WorkList<T> addAll(WorkList<T> other)
other
- The other WorkList
public boolean removeAll()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |