class WorkList[T] extends AnyRef
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.
- Source
- Aggregator.scala
- Alphabetic
- By Inheritance
- WorkList
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Instance Constructors
- new WorkList()
Value Members
-
def
add(ref: T, permanent: Boolean): WorkList[T]
Appends an entry to the work list.
Appends an entry to the work list.
- ref
The entry.
- returns
The updated work list.
-
def
addAll(other: WorkList[T]): WorkList[T]
Appends another WorkList to this WorkList.
Appends another WorkList to this WorkList.
- other
The other WorkList
- returns
This WorkList
- val head: Entry[T]
-
def
process(processFn: (T) ⇒ Boolean): Boolean
Tries to process each entry using the processing function.
Tries to process each entry using the processing function. Stops at the first entry processing succeeds. If the entry is not permanent, the entry is removed.
- processFn
The processing function, returns true if processing succeeds.
- returns
true if an entry has been processed, false if no entries are processed successfully.
-
def
remove(ref: T): Boolean
Removes an entry from the work list
Removes an entry from the work list
- ref
The entry.
- returns
True if the entry is removed, false if the entry is not found.
-
def
removeAll(): Boolean
Removes all entries from this WorkList
Removes all entries from this WorkList
- returns
True if at least one entry is removed. False if none is removed.
- var tail: Entry[T]