de.sciss.lucre.impl.PlainInMemorySet.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lucre-base_sjs1_2.13 Show documentation
Show all versions of lucre-base_sjs1_2.13 Show documentation
Extension of Scala-STM, adding optional durability layer, and providing API for confluent and reactive event layers
/*
* PlainInMemorySet.scala
* (Lucre 4)
*
* Copyright (c) 2009-2022 Hanns Holger Rutz. All rights reserved.
*
* This software is published under the GNU Affero General Public License v3+
*
*
* For further information, please contact Hanns Holger Rutz at
* [email protected]
*/
package de.sciss.lucre
package impl
import scala.collection.mutable
final class PlainInMemorySet[A] extends RefSet[Plain, A] {
private[this] val peer = mutable.Set.empty[A]
def add (elem: A)(implicit tx: Plain): Boolean = peer.add (elem)
def remove (elem: A)(implicit tx: Plain): Boolean = peer.remove (elem)
def contains(elem: A)(implicit tx: Plain): Boolean = peer.contains(elem)
def size (implicit tx: Plain): Int = peer.size
def isEmpty (implicit tx: Plain): Boolean = peer.isEmpty
def foreach[B](f: A => B)(implicit tx: Plain): Unit = peer.foreach(f)
def toSet(implicit tx: Plain): Set[A] = peer.toSet[A]
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy