diff options
author | michelou <michelou@epfl.ch> | 2009-09-15 16:14:29 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2009-09-15 16:14:29 +0000 |
commit | 4ccb0bf2b78919934cf67b901096331de638ee09 (patch) | |
tree | 407c54292d0bacd5f6ccc32e9a74b692d981b9e8 /src/actors/scala/actors/MessageQueue.scala | |
parent | 2788c1ad5b82929a1103a070f5c0bcce83a931e8 (diff) | |
download | scala-4ccb0bf2b78919934cf67b901096331de638ee09.tar.gz scala-4ccb0bf2b78919934cf67b901096331de638ee09.tar.bz2 scala-4ccb0bf2b78919934cf67b901096331de638ee09.zip |
fixed headers/comments/svn props, made some pro...
fixed headers/comments/svn props, made some progress with serializable
classes
Diffstat (limited to 'src/actors/scala/actors/MessageQueue.scala')
-rw-r--r-- | src/actors/scala/actors/MessageQueue.scala | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/actors/scala/actors/MessageQueue.scala b/src/actors/scala/actors/MessageQueue.scala index 6e69f1cdac..4435759264 100644 --- a/src/actors/scala/actors/MessageQueue.scala +++ b/src/actors/scala/actors/MessageQueue.scala @@ -17,7 +17,7 @@ package scala.actors * @version 0.9.9 * @author Philipp Haller */ -@serializable +@serializable @SerialVersionUID(7124278808020037465L) class MessageQueueElement(val msg: Any, val session: OutputChannel[Any], var next: MessageQueueElement) { def this() = this(null, null, null) def this(msg: Any, session: OutputChannel[Any]) = this(msg, session, null) @@ -32,7 +32,7 @@ class MessageQueueElement(val msg: Any, val session: OutputChannel[Any], var nex * @version 0.9.9 * @author Philipp Haller */ -@serializable +@serializable @SerialVersionUID(2168935872884095767L) class MessageQueue(protected val label: String) { protected var first: MessageQueueElement = null protected var last: MessageQueueElement = null // last eq null iff list is empty @@ -41,7 +41,7 @@ class MessageQueue(protected val label: String) { def size = _size final def isEmpty = last eq null - protected def changeSize(diff: Int) = { + protected def changeSize(diff: Int) { _size += diff } @@ -73,7 +73,7 @@ class MessageQueue(protected val label: String) { acc } - /** Returns the n-th msg that satisfies the predicate + /** Returns the n-th message that satisfies the predicate <code>p</code> * without removing it. */ def get(n: Int)(p: Any => Boolean): Option[Any] = { @@ -90,11 +90,14 @@ class MessageQueue(protected val label: String) { None } - /** Removes the n-th msg that satisfies the predicate. + /** Removes the n-th message that satisfies the predicate <code>p</code>. */ def remove(n: Int)(p: Any => Boolean): Option[(Any, OutputChannel[Any])] = removeInternal(n)(p) map (x => (x.msg, x.session)) + /** Extracts the first message that satisfies the predicate <code>p</code> + * or <code>null</code> if <code>p</code> fails for all of them. + */ def extractFirst(p: Any => Boolean): MessageQueueElement = removeInternal(0)(p) orNull @@ -185,4 +188,4 @@ object MessageQueueTracer { queueNumberAssigner += 1 queueNumberAssigner } -}
\ No newline at end of file +} |