Packages

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

    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
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. def ++[B >: A](other: Generator[B]): Generator[B]
  4. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate() @throws( ... )
  7. def collect[B](func: PartialFunction[A, B]): Generator[B]
  8. def collectFirst[B](func: PartialFunction[A, B]): Option[B]
  9. def contains(a: Any): Boolean
  10. def count(f: (A) ⇒ Boolean = _ => true): Int
  11. def drop(n: Int): Generator[A]
  12. def dropWhile(pred: (A) ⇒ Boolean): Generator[A]
  13. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  15. def exists(f: (A) ⇒ Boolean): Boolean
  16. def filter(pred: (A) ⇒ Boolean): Generator[A]
  17. def find(f: (A) ⇒ Boolean): Option[A]
  18. def flatMap[B](func: (A) ⇒ Generator[B]): Generator[B]
  19. def flatten[V](implicit f: (A) ⇒ Generator[V]): Generator[V]
  20. def fold[B](start: B)(f: (B, A) ⇒ B): B
  21. def foldLeft[B](start: B)(f: (B, A) ⇒ B): B
  22. def forall(f: (A) ⇒ Boolean): Boolean
  23. def foreach(f: (A) ⇒ Unit): Unit
  24. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  25. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  26. def head: A
  27. def headOption: Option[A]
  28. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  29. def map[B](func: (A) ⇒ B): Generator[B]
  30. def max[B >: A](implicit cmp: Ordering[B]): A
  31. def maxBy[B](f: (A) ⇒ B)(implicit cmp: Ordering[B]): A
  32. def min[B >: A](implicit cmp: Ordering[B]): A
  33. def minBy[B](f: (A) ⇒ B)(implicit cmp: Ordering[B]): A
  34. def mkString: String
  35. def mkString(sep: String): String
  36. def mkString(start: String, sep: String, end: String): String
  37. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  38. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  39. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  40. def product[B >: A](implicit num: Numeric[B]): B
  41. def reduce[B >: A](f: (B, A) ⇒ B): B
  42. def reduceLeft[B >: A](f: (B, A) ⇒ B): B
  43. def slice(start: Int, end: Int): Generator[A]
  44. def sum[B >: A](implicit num: Numeric[B]): B
  45. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  46. def take(n: Int): Generator[A]
  47. def takeWhile(pred: (A) ⇒ Boolean): Generator[A]
  48. def toArray[B >: A](implicit arg0: ClassTag[B]): Array[B]
  49. def toBuffer[B >: A]: Buffer[B]
  50. def toList: List[A]
  51. def toSeq: Seq[A]
  52. def toSet[B >: A]: Set[B]
  53. def toString(): String
    Definition Classes
    AnyRef → Any
  54. def toVector: Vector[A]
  55. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  56. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  57. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  58. def withFilter(pred: (A) ⇒ Boolean): Generator[A]
  59. def zip[B](other: Iterable[B]): Generator[(A, B)]
  60. def zipWithIndex: Generator[(A, Int)]

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @Deprecated @deprecated @throws( classOf[java.lang.Throwable] )
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from AnyRef

Inherited from Any

Ungrouped