summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/mutable/History.scala
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2009-09-15 16:14:29 +0000
committermichelou <michelou@epfl.ch>2009-09-15 16:14:29 +0000
commit4ccb0bf2b78919934cf67b901096331de638ee09 (patch)
tree407c54292d0bacd5f6ccc32e9a74b692d981b9e8 /src/library/scala/collection/mutable/History.scala
parent2788c1ad5b82929a1103a070f5c0bcce83a931e8 (diff)
downloadscala-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/library/scala/collection/mutable/History.scala')
-rw-r--r--src/library/scala/collection/mutable/History.scala14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/library/scala/collection/mutable/History.scala b/src/library/scala/collection/mutable/History.scala
index 27d7b8c40e..1e96b7accd 100644
--- a/src/library/scala/collection/mutable/History.scala
+++ b/src/library/scala/collection/mutable/History.scala
@@ -21,6 +21,7 @@ package scala.collection.mutable
* @version 1.0, 08/07/2003
*/
@serializable
+@SerialVersionUID(5219213543849892588L)
class History[A, B] extends AnyRef with Subscriber[A, B] with Iterable[(B, A)]
{
protected val log: Queue[(B, A)] = new Queue[(B, A)]
@@ -30,7 +31,7 @@ class History[A, B] extends AnyRef with Subscriber[A, B] with Iterable[(B, A)]
* @param pub ...
* @param event ...
*/
- def notify(pub: B, event: A): Unit = {
+ def notify(pub: B, event: A) {
if (log.length >= maxHistory)
log.dequeue
@@ -41,5 +42,14 @@ class History[A, B] extends AnyRef with Subscriber[A, B] with Iterable[(B, A)]
def iterator: Iterator[(B, A)] = log.iterator
def events: Iterator[A] = log.iterator.map { case (_, e) => e }
- def clear(): Unit = log.clear
+ def clear() { log.clear }
+
+ /** Checks if two history objects are structurally identical.
+ *
+ * @return true, iff both history objects contain the same sequence of elements.
+ */
+ override def equals(obj: Any): Boolean = obj match {
+ case that: History[_, _] => this.log equals that.log
+ case _ => false
+ }
}