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
    @HotSpotIntrinsicCandidate() @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 = _ => 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 find(f: (A) ⇒ Boolean): Option[A]

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

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

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

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

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  25. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  26. def head: A

    Permalink
  27. def headOption: Option[A]

    Permalink
  28. final def isInstanceOf[T0]: Boolean

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

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

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

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

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

    Permalink
  34. def mkString: String

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

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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  39. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  40. def product[B >: A](implicit num: Numeric[B]): B

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

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

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

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

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

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

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

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

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

    Permalink
  50. def toList: List[A]

    Permalink
  51. def toSeq: Seq[A]

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

    Permalink
  53. def toString(): String

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

    Permalink
  55. final def wait(arg0: Long, arg1: Int): Unit

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  57. final def wait(): Unit

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

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

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

    Permalink

Deprecated Value Members

  1. def finalize(): Unit

    Permalink
    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