Pipe Types

okram edited this page Mar 20, 2013 · 7 revisions

There are 4 types of pipes.

  1. Transform: take an object of type S and emit an object of type E.
    • TransformPipe<S,E> extends Pipe<S,E>
  2. Filter: take an object of type S and either emit it or not.
    • FilterPipe<S> extends Pipe<S,S>
  3. Side-Effect: take an object of type S, perform some computation, emit the same object.
    • SideEffectPipe<S,T> extends Pipe<S,S>
  4. Branch: take an object and select any number of paths to send it down.

The packaging of Pipes is set up such that there is a transform, filter, sideeffect, and branch package. All pipes are instances of one of these 4 types. Moreover, each type has a special “function”-version known as a XXXFunctionPipe. For example: TransformFunctionPipe, FilterFunctionPipe, and SideEffectFunctionPipe. These pipes are discussed in their respective sections of the documentation. However, the general description of a PipeFunction is presented next.

Pipe Function

Pipes has an interface called PipeFunction<A,B> that has the following methods:

public B compute(A argument);

A pipe that takes a PipeFunction will use the provided compute() method at a particular point according to the semantics of the pipe. Thus, the JavaDoc of such pipes will articulate the meaning/use of the provided PipeFunction.