t

Stream.Flow._extend

trait _Trait[A] extends _filter[A] with _flow[A] with _map[A] with _peek[A]

Self Type
Stream.Flow[A]
Ordering
  1. Alphabetic
Inherited
  1. Flow._extend
  2. Flow._extend._peek
  3. Flow._extend._map
  4. Flow._extend._flow
  5. Flow._extend._filter
  6. Flow._extend.Z.Shared
  7. scala.AnyRef
  8. scala.Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Method

  1. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  2. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  3. def drop(f: Filter[A]): Flow[A]

    Reversed filter

    Reversed filter

    Discards all the elements satisfying the filter

    (1 <> 10).all.drop(_ % 2 == 0).lp // Prints: ~(1, 3, 5, 7, 9)
    Definition Classes
    _filter
  4. def dropVoid: Flow[A]

    Reversed filter for void

    Reversed filter for void

    Discards all the objects which test Any.isVoid positive from the pipeline

    def all = ("A" ~+ null + "B" + "" + "C")
    
    all.lp              // Prints: ~(A, null, B, void, C)
    
    all.dropVoid.lp     // Prints: ~(A, B, C)
    Definition Classes
    _filter
  5. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  6. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  7. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  8. abstract def flatMap[B](f: Mapping[A, ~[B]])(implicit arg0: Ilk[B]): Flow[B]

    Map multiplier

    Map multiplier

    For every existing element, a mapped stream of elements is inserted into the pipeline

    Note. The mapping can return an empty stream, in which case total number of elements might even be reduced

    f

    function to provide a stream of elements for each existing element

    Definition Classes
    _map
    Example:
    1. ~.*(1, 2, 3).flatMap(i => ~.*(i * 10, i * 100, i * 1000)).lp
      
      // Output
      ~(10, 100, 1000, 20, 200, 2000, 30, 300, 3000)
  9. def hashCode(): Int
    Definition Classes
    AnyRef → Any
  10. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  11. abstract def let(f: Filter[A]): Flow[A]

    Main filter

    Main filter

    Only lets elements satisfying the filter

    let is the main filtering method. It's equivalent in Java and Scala is called filter

    (1 <> 10).all.let(_ % 2 == 0).lp // Prints: ~(2, 4, 6, 8, 10)
    Definition Classes
    _filter
  12. def letBy[T](property: Mapping[A, T], f: Filter[T]): Flow[A]

    Property filter

    Property filter

    Only lets elements satisfying the filter on given property

    val filter: Stream.Filter[Int] = _ >= 2
    
    ("ABC" ~+ "D" + "E" + "FG").letBy(_.length, filter).lp // Prints: ~(ABC, FG)

    Note: This might be useful when existing filters are reused

    Definition Classes
    _filter
  13. def letLookup[B](f: PartialFunction[A, B])(implicit arg0: Ilk[B]): Flow[B]

    Filter and converter

    Filter and converter

    Only lets elements for which given PartialFinction is defined

    The elements are converted to the new type

    def all = ~[Any] + "ABC" + 1 + 22.0 + "DE" + 333F + "F"
    
    all.letLookup({ case s: String if (s.length > 1) => s }).lp
    
    // Output
    ~(ABC, DE)
    Definition Classes
    Shared
    Note

    'letLookup' always requires double evaluation for each element, so 'letMap' is preferred in many cases

  14. def letMap[B](f: Mapping[A, Opt[B]])(implicit arg0: Ilk[B]): Flow[B]

    Filter and converter

    Filter and converter

    Only lets elements for which given function returns non empty Opt

    The elements are converted to the new type

    def all = "ABC" ~+ "1" + "22" + "D" + "333" + "E"
    
    all.letMap(v => if (v.length < 2) \/ else v).lp // Prints: ~(ABC, 22, 333)
    
    all.letMap({
      case s if (s.length >= 2) => s
      case _                    => \/
    }).lp                                           // Prints: ~(ABC, 22, 333)
    
    all.letMap(_.toIntOut.valueOpt).lp              // Prints: ~(1, 22, 333)

    Note: 'letMap' is a better alternative to letLookup with PartialFunction, because it is evaluated just once for each element

    Definition Classes
    Shared
  15. def letType[B](implicit t: ClassTag[B]): Flow[B]

    Filter and type converter

    Filter and type converter

    Only lets elements, which are instances of the given type

    Note, the result is mapped to the specified type

    def all = ~[Any] + "1" + 2 + 3.0 + 4l + "5"
    
    all.lp                  // Prints ~(1, 2, 3.0, 4, 5)
    
    all.letType[String].lp  // Prints ~(1, 5)
    Definition Classes
    Shared
  16. abstract def map[B](f: Mapping[A, B])(implicit arg0: Ilk[B]): Flow[B]

    Element conversion

    Element conversion

    Converts every element in the pipeline with given function

    (1 <> 5).all.map( _ / 2.0).lp
    
    // Output
    ~(0.5, 1.0, 1.5, 2.0, 2.5)
    Definition Classes
    _map
  17. def mapType[B]: Flow[B]

    Element cast

    Element cast

    Casts the pipeline elements into the type specified

    def all: ~[Any] = 1 ~+ 2 + 3
    
    all.mapType[Int].lp // Prints: ~(1, 2, 3)
    Definition Classes
    _map
    Note

    If there is a problem for element casting, it will come up later during pumping action

  18. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  19. final def notify(): Unit
    Definition Classes
    AnyRef
  20. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  21. abstract def peek(c: Consumer[A]): Flow[A]

    Element access

    Element access

    Provides access to passing pipeline elements

    This method does not change pipeline type or composition in any way

    ('A' <> 'C').all.peek("Passing: " + _ lp).count.lp
    
    // Output
    Passing: A
    Passing: B
    Passing: C
    3
    Definition Classes
    _peek
  22. def peekIdx(c: Consumer.Idx[A], start: Int = 0): Flow[A]

    Indexed element access

    Indexed element access

    Provides access to passing pipeline elements with their index in sequence

    start

    starting value for element indexing

    ('A' <> 'C').all.peekIdx("Peek" + _ + " = " + _ lp).count.lp
    
    // Output
    Peek 0 = A
    Peek 1 = B
    Peek 2 = C
    3
    Definition Classes
    _peek
  23. def sequential: Stream[A]

    Restore Flow to Stream

    Restore Flow to Stream

    Restores potentially parallel Flow back to Stream

    If this object is already a Stream, the operation is instant

    Otherwise the operation is quite expensive

    In many cases it is advisable to consume pipeline as Flow instead of converting to Stream

    (1 <> 1000).all
       .parallel                       // Switching to parallel Stream.Flow
       .peek(_ => App.pause(1.Millis)) // Expensive operation
       .sequential                     // Back to Stream
       .countAndTime("Count = " + _ + "\tDone in " + _ lp)
    
    // Output
    Count = 1000   Done in 0.186 sec
    Definition Classes
    _flow
  24. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  25. def toString(): String
    Definition Classes
    AnyRef → Any
  26. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Operator

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any