trait
Generator[+A] extends AnyRef
Abstract Value Members
-
abstract
def
generate(handleItem: (A) ⇒ Action): Action
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
-
final
def
==(arg0: Any): Boolean
-
final
def
asInstanceOf[T0]: T0
-
def
clone(): AnyRef
-
def
collect[B](func: PartialFunction[A, B]): Generator[B]
-
def
collectFirst[B](func: PartialFunction[A, B]): Option[B]
-
def
contains(a: Any): Boolean
-
def
count(f: (A) ⇒ Boolean = _ => true): Int
-
def
drop(n: Int): Generator[A]
-
def
dropWhile(pred: (A) ⇒ Boolean): Generator[A]
-
final
def
eq(arg0: AnyRef): Boolean
-
def
equals(arg0: Any): Boolean
-
def
exists(f: (A) ⇒ Boolean): Boolean
-
def
filter(pred: (A) ⇒ Boolean): Generator[A]
-
def
find(f: (A) ⇒ Boolean): Option[A]
-
-
def
flatten[V](implicit f: (A) ⇒ Generator[V]): Generator[V]
-
def
fold[B](start: B)(f: (B, A) ⇒ B): B
-
def
foldLeft[B](start: B)(f: (B, A) ⇒ B): B
-
def
forall(f: (A) ⇒ Boolean): Boolean
-
def
foreach(f: (A) ⇒ Unit): Unit
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
def
head: A
-
def
headOption: Option[A]
-
final
def
isInstanceOf[T0]: Boolean
-
def
map[B](func: (A) ⇒ B): Generator[B]
-
def
max[B >: A](implicit cmp: Ordering[B]): A
-
def
maxBy[B](f: (A) ⇒ B)(implicit cmp: Ordering[B]): A
-
def
min[B >: A](implicit cmp: Ordering[B]): A
-
def
minBy[B](f: (A) ⇒ B)(implicit cmp: Ordering[B]): A
-
def
mkString: String
-
def
mkString(sep: String): String
-
def
mkString(start: String, sep: String, end: String): String
-
final
def
ne(arg0: AnyRef): Boolean
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
def
product[B >: A](implicit num: Numeric[B]): B
-
def
reduce[B >: A](f: (B, A) ⇒ B): B
-
def
reduceLeft[B >: A](f: (B, A) ⇒ B): B
-
def
slice(start: Int, end: Int): Generator[A]
-
def
sum[B >: A](implicit num: Numeric[B]): B
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
take(n: Int): Generator[A]
-
def
takeWhile(pred: (A) ⇒ Boolean): Generator[A]
-
def
toArray[B >: A](implicit arg0: ClassTag[B]): Array[B]
-
def
toBuffer[B >: A]: Buffer[B]
-
def
toList: List[A]
-
def
toSeq: Seq[A]
-
def
toSet[B >: A]: Set[B]
-
def
toString(): String
-
def
toVector: Vector[A]
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
-
final
def
wait(): Unit
-
def
withFilter(pred: (A) ⇒ Boolean): Generator[A]
-
def
zip[B](other: Iterable[B]): Generator[(A, B)]
-
def
zipWithIndex: Generator[(A, Int)]
Deprecated Value Members
-
def
finalize(): Unit
Inherited from AnyRef
Inherited from Any
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-basedhasNext
andnext: T
methods, the core is based around the push-basedgenerate
method.generate
is basically an extra-customizable version offoreach
, 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 thegenerate
call is made.Transformations on a Generator are lazy: calling methods like
filter
ormap
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 likegenerate
/foreach
/find
, or the "Conversion" methods liketoArray
or similar.generate
takes a function returningGen.Action
rather thatUnit
. 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.