com.twitter.algebird

Batched

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, Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Batched
  2. Serializable
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Batched()

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: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. 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.

  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. 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.

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

  11. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  12. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  13. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  15. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  16. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  17. 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.

  18. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  19. final def notify(): Unit

    Definition Classes
    AnyRef
  20. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  21. 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.

  22. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  23. def toList: List[T]

    Convert the batch to a List[T].

  24. def toString(): String

    Definition Classes
    AnyRef → Any
  25. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  26. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped