All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.sciss.lucre.impl.DummyEvent.scala Maven / Gradle / Ivy

Go to download

Extension of Scala-STM, adding optional durability layer, and providing API for confluent and reactive event layers

The newest version!
/*
 *  DummyEvent.scala
 *  (Lucre 4)
 *
 *  Copyright (c) 2009-2024 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

object DummyEvent {
  /** This method is cheap. */
  def apply[T <: Txn[T], A](): DummyEvent[T, A] = anyDummy.asInstanceOf[DummyEvent[T, A]]

  private val anyDummy = new Impl[AnyTxn]

  private final class Impl[T <: Txn[T]] extends DummyEvent[T, Any] {
    override def toString = "event.Dummy"
  }

  private def opNotSupported = sys.error("Operation not supported")
}

trait DummyEvent[T <: Txn[T], +A] extends EventLike[T, A] {
  import DummyEvent._

  final def ---> (sink: Event[T, Any])(implicit tx: T): Unit = ()
  final def -/-> (sink: Event[T, Any])(implicit tx: T): Unit = ()

  final def react(fun: T => A => Unit)(implicit tx: T): Disposable[T] = Disposable.empty[T]

  private[lucre] final def pullUpdate(pull: Pull[T])(implicit tx: T): Option[A] = opNotSupported
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy