ru.primetalk.synapse.core.Signal.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of synapse-grid-core Show documentation
Show all versions of synapse-grid-core Show documentation
SynapseGrid is a framework for constructing reactive real-time immutable data flow systems. -core contains everything to run a single-threaded system, -akka contains everything to run systemsover Akka actors, -slf4j - enables logging, -examples - a few test systems.
The newest version!
///////////////////////////////////////////////////////////////
// © ООО «Праймтолк», 2011-2013 //
// Все права принадлежат компании ООО «Праймтолк». //
///////////////////////////////////////////////////////////////
/**
* SynapseGrid
* © Primetalk Ltd., 2013.
* All rights reserved.
* Authors: A.Zhizhelev, A.Nehaev, P. Popov
*
* Created: 21.08.13, zhizhelev
*/
package ru.primetalk.synapse.core
import scala.language.implicitConversions
/**
* Signal is a pair of contact and data on it.
*/
case class Signal[T](contact: Contact[T], data: T) {
def _1 = contact
def _2 = data
}
/** Sometimes signals are processed as a batch of data on the same contact.
* The Batch can be used interchangeably with List[Signal[T]]*/
case class Batch[T](contact: Contact[T], data: List[T]) {
def _1 = contact
lazy val signals = data.map(Signal(contact, _))
}
object Batch {
implicit def batchToSignals[T](b:Batch[T]) = b.signals
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy