blob: 47396fdb8432e325df4bf62e21f0ce9c01ecf052 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
// $Id$
package scala.collection.mutable
/** This class should be used as a mixin. It synchronizes the <code>Set</code>
* functions of the class into which it is mixed in.
*
* @author Matthias Zenger
* @version 1.0, 08/07/2003
*/
trait SynchronizedSet[A] extends Set[A] {
import collection.Traversable
abstract override def size: Int = synchronized {
super.size
}
override def isEmpty: Boolean = synchronized {
super.isEmpty
}
abstract override def contains(elem: A) = synchronized {
super.contains(elem)
}
abstract override def update(elem: A, included: Boolean): Unit = synchronized {
super.update(elem, included)
}
abstract override def +=(elem: A): Unit = synchronized {
super.+=(elem)
}
override def ++=(that: Traversable[A]) = synchronized {
super.++=(that)
}
override def ++=(it: Iterator[A]) = synchronized {
super.++=(it)
}
abstract override def -=(elem: A): Unit = synchronized {
super.-=(elem)
}
override def --=(that: Traversable[A]) = synchronized {
super.--=(that)
}
override def --=(it: Iterator[A]) = synchronized {
super.--=(it)
}
override def intersect(that: collection.Set[A]) = synchronized[this.type] {
super.intersect(that)
}
abstract override def clear(): Unit = synchronized {
super.clear
}
override def subsetOf(that: scala.collection.Set[A]) = synchronized {
super.subsetOf(that)
}
override def foreach(f: A => Unit) = synchronized {
super.foreach(f)
}
override def retain(p: A => Boolean) = synchronized {
super.retain(p)
}
override def toList: List[A] = synchronized {
super.toList
}
override def toString = synchronized {
super.toString
}
/* TODO: Reintegrate
override def <<(cmd: Message[A]): Unit = synchronized {
super.<<(cmd)
}
*/
override def clone(): Set[A] = synchronized {
super.clone()
}
}
|