diff options
author | Paul Phillips <paulp@improving.org> | 2009-05-27 05:13:18 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-05-27 05:13:18 +0000 |
commit | 21733eb9fd9a97c2a1ab7f7b0e313166fdeb9b6c (patch) | |
tree | 0dfa1546c3e04c33d9b5e6814ac9c8c4ee9b64db /src/library/scala/collection/mutable/ObservableSet.scala | |
parent | 9ed3fc1dbd90ae93b5bd7abe010a42196e5dee69 (diff) | |
download | scala-21733eb9fd9a97c2a1ab7f7b0e313166fdeb9b6c.tar.gz scala-21733eb9fd9a97c2a1ab7f7b0e313166fdeb9b6c.tar.bz2 scala-21733eb9fd9a97c2a1ab7f7b0e313166fdeb9b6c.zip |
Not quite complete reintegration of a handful o...
Not quite complete reintegration of a handful of collection classes, but
they compile quietly and keep to themselves (of course that's always
what the neighbors say after some loner goes on a rampage, so it's not
the innocuous description it once was.)
Diffstat (limited to 'src/library/scala/collection/mutable/ObservableSet.scala')
-rw-r--r-- | src/library/scala/collection/mutable/ObservableSet.scala | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/library/scala/collection/mutable/ObservableSet.scala b/src/library/scala/collection/mutable/ObservableSet.scala index a9408f406e..31dd10c8b9 100644 --- a/src/library/scala/collection/mutable/ObservableSet.scala +++ b/src/library/scala/collection/mutable/ObservableSet.scala @@ -1,4 +1,3 @@ -/* TODO: Reintegrate /* __ *\ ** ________ ___ / / ___ Scala API ** ** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL ** @@ -12,6 +11,7 @@ package scala.collection.mutable +import script._ /** This class is typically used as a mixin. It adds a subscription * mechanism to the <code>Set</code> class into which this abstract @@ -23,8 +23,7 @@ package scala.collection.mutable */ trait ObservableSet[A, This <: ObservableSet[A, This]] extends Set[A] - with Publisher[Message[A] - with Undoable, This] + with Publisher[Message[A] with Undoable, This] { self: This => abstract override def +=(elem: A): this.type = { @@ -35,9 +34,12 @@ trait ObservableSet[A, This <: ObservableSet[A, This]] this } - abstract override def -=(elem: A): Unit = if (contains(elem)) { - super.-=(elem) - publish(new Remove(elem) with Undoable { def undo = +=(elem) }) + abstract override def -=(elem: A): this.type = { + if (contains(elem)) { + super.-=(elem) + publish(new Remove(elem) with Undoable { def undo = +=(elem) }) + } + this } abstract override def clear(): Unit = { @@ -47,4 +49,3 @@ trait ObservableSet[A, This <: ObservableSet[A, This]] }) } } -*/ |