blob: f9fcb635b62eeb46cf01af8d0564eec944717fa6 (
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
|
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
// $Id$
package scala.collection.mutable
/** A revertable history is a <code>History</code> object which supports
* an undo operation. Type variable <code>A</code> refers to the type
* of the published events, <code>B</code> denotes the publisher type.
* Type <code>B</code> is typically a subtype of <code>Publisher</code>.
*
* @author Matthias Zenger
* @version 1.0, 08/07/2003
*/
[serializable]
class RevertableHistory[A <: Undoable, B] extends History[A, B] with Undoable {
/** Rollback the full history.
*/
def undo: Unit = {
val old = log.toList.reverse
clear
old.foreach { case {sub, event} => event.undo }
}
}
|