Packages

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.

Linear Supertypes
Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Batched
  2. Serializable
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def size: Int

    Report the size of the underlying tree structure.

    Report the size of the underlying tree structure.

    This is an O(1) operation -- each subtree knows how big it is.

  2. abstract def sum(implicit sg: Semigroup[T]): T

    Sum all the T values in this batch using the given semigroup.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. 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.

  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  7. 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 and that.

  8. 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.

  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  12. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  15. 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.

  16. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  18. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  19. 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.

  20. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  21. def toList: List[T]

    Convert the batch to a List[T].

  22. def toString(): String
    Definition Classes
    AnyRef → Any
  23. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  24. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  25. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped