Trait/Object

geny

Generator

Related Docs: object Generator | package geny

Permalink

trait Generator[+A] extends AnyRef

Provides the geny.Gen data type, A Generator of elements of type A.

Generator is basically the inverse of a scala.Iterator: instead of the core functionality being the pull-based hasNext and next: T methods, the core is based around the push-based generate method. generate is basically an extra-customizable version of foreach, which allows the person calling it to provide basic control-flow instructions to the upstream Gens.

Unlike a scala.Iterator, subclasses of Generator can guarantee any clean up logic is performed by placing it after the generate call is made.

Transformations on a Generator are lazy: calling methods like filter or map do not evaluate the entire Gen, but instead construct a new Gen that delegates to the original. The only methods that evaluate the Generator are the "Action" methods like generate/foreach/find, or the "Conversion" methods like toArray or similar.

generate takes a function returning Gen.Action rather that Unit. This allows a downstream Gen to provide basic control commands to the upstream Gens: i.e. Generator.End to cease enumeration of the upstream Gen. This allows it to avoid traversing and processing elements that the downstream Gen doesn't want/need to see anyway.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Generator
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def generate(handleItem: (A) ⇒ Action): Action

    Permalink

    The core abstract method that defines the Generator trait.

    The core abstract method that defines the Generator trait. It is essentially the same as .foreach, but with additional configurability.

    handleItem

    How to handle a single item: performs any desired side effects, and returns a Generator.Action that determines how to continue the enumeration.

    returns

    an integer stating how many skipped elements from the startingSkipped input remain to be skipped after this generate call has completed.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def ++[B >: A](other: Generator[B]): Generator[B]

    Permalink
  4. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def collect[B](func: PartialFunction[A, B]): Generator[B]

    Permalink
  8. def collectFirst[B](func: PartialFunction[A, B]): Option[B]

    Permalink
  9. def contains(a: Any): Boolean

    Permalink
  10. def count(f: (A) ⇒ Boolean = (_: Any) => true): Int

    Permalink
  11. def drop(n: Int): Generator[A]

    Permalink
  12. def dropWhile(pred: (A) ⇒ Boolean): Generator[A]

    Permalink
  13. final def eq(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  15. def exists(f: (A) ⇒ Boolean): Boolean

    Permalink
  16. def filter(pred: (A) ⇒ Boolean): Generator[A]

    Permalink
  17. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  18. def find(f: (A) ⇒ Boolean): Option[A]

    Permalink
  19. def flatMap[B](func: (A) ⇒ Generator[B]): Generator[B]

    Permalink
  20. def flatten[V](implicit f: (A) ⇒ Generator[V]): Generator[V]

    Permalink
  21. def fold[B](start: B)(f: (B, A) ⇒ B): B

    Permalink
  22. def foldLeft[B](start: B)(f: (B, A) ⇒ B): B

    Permalink
  23. def forall(f: (A) ⇒ Boolean): Boolean

    Permalink
  24. def foreach(f: (A) ⇒ Unit): Unit

    Permalink
  25. final def getClass(): Class[_]

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

    Permalink
    Definition Classes
    AnyRef → Any
  27. def head: A

    Permalink
  28. def headOption: Option[A]

    Permalink
  29. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  30. def map[B](func: (A) ⇒ B): Generator[B]

    Permalink
  31. def max[B >: A](implicit cmp: Ordering[B]): A

    Permalink
  32. def maxBy[B](f: (A) ⇒ B)(implicit cmp: Ordering[B]): A

    Permalink
  33. def min[B >: A](implicit cmp: Ordering[B]): A

    Permalink
  34. def minBy[B](f: (A) ⇒ B)(implicit cmp: Ordering[B]): A

    Permalink
  35. def mkString: String

    Permalink
  36. def mkString(sep: String): String

    Permalink
  37. def mkString(start: String, sep: String, end: String): String

    Permalink
  38. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  39. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  40. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  41. def product[B >: A](implicit num: Numeric[B]): B

    Permalink
  42. def reduce[B >: A](f: (B, A) ⇒ B): B

    Permalink
  43. def reduceLeft[B >: A](f: (B, A) ⇒ B): B

    Permalink
  44. def slice(start: Int, end: Int): Generator[A]

    Permalink
  45. def sum[B >: A](implicit num: Numeric[B]): B

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

    Permalink
    Definition Classes
    AnyRef
  47. def take(n: Int): Generator[A]

    Permalink
  48. def takeWhile(pred: (A) ⇒ Boolean): Generator[A]

    Permalink
  49. def toArray[B >: A](implicit arg0: ClassTag[B]): Array[B]

    Permalink
  50. def toBuffer[B >: A]: Buffer[B]

    Permalink
  51. def toList: List[A]

    Permalink
  52. def toSeq: Seq[A]

    Permalink
  53. def toSet[B >: A]: Set[B]

    Permalink
  54. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  55. def toVector: Vector[A]

    Permalink
  56. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  59. def withFilter(pred: (A) ⇒ Boolean): Generator[A]

    Permalink
  60. def zip[B](other: Iterable[B]): Generator[(A, B)]

    Permalink
  61. def zipWithIndex: Generator[(A, Int)]

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped