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 contains(a: Any): Boolean

    Permalink
  8. def count(f: (A) ⇒ Boolean): Int

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

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

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

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

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

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

    Permalink
  15. def finalize(): Unit

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

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

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

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

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

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

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

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

    Permalink
  24. final def isInstanceOf[T0]: Boolean

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

    Permalink
  26. def mkString: String

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

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

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

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

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

    Permalink
    Definition Classes
    AnyRef
  32. def reduceLeft[B >: A](f: (B, A) ⇒ B): B

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

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

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

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

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

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

    Permalink
  39. def toList: List[A]

    Permalink
  40. def toSeq: Seq[A]

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

    Permalink
  42. def toString(): String

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

    Permalink
  44. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  47. def zip[B](other: Iterable[B]): Generator[(A, B)]

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

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped