sealed abstract class Batched[T] extends Serializable
Batched: the free semigroup.
For any type T
, Batched[T]
represents a way to lazily combine T values as a semigroup would (i.e.
associatively). A Semigroup[T]
instance can be used to recover a T
value from a Batched[T]
.
Like other free structures, Batched trades space for time. A sum of batched values defers the underlying
semigroup action, instead storing all values in memory (in a tree structure). If an underlying semigroup is
available, Batched.semigroup
and Batch.monoid
can be configured to periodically sum the tree to keep
the overall size below batchSize
.
Batched[T]
values are guaranteed not to be empty -- that is, they will contain at least one T
value.
- Alphabetic
- By Inheritance
- Batched
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def append(that: TraversableOnce[T]): Batched[T]
Add more values to a batched value.
Add more values to a batched value.
This method will grow the tree to the left.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def combine(that: Batched[T]): Batched[T]
Combine two batched values.
Combine two batched values.
As mentioned above, this just creates a new tree structure containing
this
andthat
. - def compact(batchSize: Int)(implicit s: Semigroup[T]): Batched[T]
Compact this batch if it exceeds
batchSize
.Compact this batch if it exceeds
batchSize
.Compacting a branch means summing it, and then storing the summed value in a new single-item batch.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def iterator: Iterator[T]
Provide an iterator over the underlying tree structure.
Provide an iterator over the underlying tree structure.
This is the order used by
.sum
.This iterator traverses the tree from left-to-right. If the original expression was (w + x + y + z), this iterator returns w, x, y, and then z.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def reverseIterator: Iterator[T]
Provide a reversed iterator over the underlying tree structure.
Provide a reversed iterator over the underlying tree structure.
This iterator traverses the tree from right-to-left. If the original expression was (w + x + y + z), this iterator returns z, y, x, and then w.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toList: List[T]
Convert the batch to a
List[T]
. - def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()