cascading.pipe
Class Pipe

java.lang.Object
  extended by cascading.pipe.Pipe
All Implemented Interfaces:
FlowElement, Serializable
Direct Known Subclasses:
ElementGraph.Extent, Group, Operator, SubAssembly

public class Pipe
extends Object
implements FlowElement, Serializable

Class Pipe is used to name branches in pipe assemblies, and as a base class for core processing model types, specifically Each, Every, GroupBy, and CoGroup.

Pipes are chained together through their constructors.

To effect a split in the pipe, simply pass a Pipe instance to two or more constructors of subsequent Pipe instances.

A join can be achieved by passing two or more Pipe instances to a CoGroup pipe.

A merge can be achieved by passing two or more Pipe instances to a GroupBy pipe.

See Also:
Each, Every, GroupBy, CoGroup, Serialized Form

Field Summary
protected  Pipe previous
          Field previous
 
Constructor Summary
protected Pipe()
           
protected Pipe(Pipe previous)
           
  Pipe(String name)
          Constructor Pipe creates a new Pipe instance with the given name.
  Pipe(String name, Pipe previous)
          Constructor Pipe creates a new Pipe instance with the given name and previous Pipe instance.
 
Method Summary
 boolean equals(Object object)
           
 Pipe[] getHeads()
          Method getHeads returns the first Pipe instances in this pipe assembly.
 String getName()
          Get the name of this pipe.
 Pipe[] getPrevious()
          Get all the upstream pipes this pipe is connected to.
 String getTrace()
          Method getTrace returns a String that pinpoint where this instance was created for debugging.
 int hashCode()
           
 boolean isEquivalentTo(FlowElement element)
           
static String[] names(Pipe... tails)
          Convenience method for finding all Pipe names in an assembly.
 Scope outgoingScopeFor(Set<Scope> incomingScopes)
          Method outgoingScopeFor returns the Scope this FlowElement hands off to the next FlowElement.
static Pipe[] pipes(Pipe... pipes)
          Convenience method to create an array of Pipe instances.
 String print(Scope scope)
          Method print is used internally.
protected  void printInternal(StringBuffer buffer, Scope scope)
           
 Fields resolveFields(Scope scope)
          Method resolveFields returns the actual field names represented by the given Scope.
 Fields resolveIncomingOperationFields(Scope incomingScope)
          Method resolveIncomingOperationFields resolves the incoming scopes to the actual incoming operation field names.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

previous

protected Pipe previous
Field previous

Constructor Detail

Pipe

protected Pipe()

Pipe

@ConstructorProperties(value="previous")
protected Pipe(Pipe previous)

Pipe

@ConstructorProperties(value="name")
public Pipe(String name)
Constructor Pipe creates a new Pipe instance with the given name. This is useful as the 'start' or head of a pipe assembly.

Parameters:
name - name for this branch of Pipes

Pipe

@ConstructorProperties(value={"name","previous"})
public Pipe(String name,
                                       Pipe previous)
Constructor Pipe creates a new Pipe instance with the given name and previous Pipe instance. This is useful for naming a branch in a pipe assembly. Or renaming the branch mid-way down.

Parameters:
name - name for this branch of Pipes
previous - previous Pipe to receive input Tuples from
Method Detail

pipes

public static Pipe[] pipes(Pipe... pipes)
Convenience method to create an array of Pipe instances.

Parameters:
pipes - vararg list of pipes
Returns:
array of pipes

names

public static String[] names(Pipe... tails)
Convenience method for finding all Pipe names in an assembly.

Parameters:
tails - vararg list of all tails in given assembly
Returns:
array of Pipe names

getName

public String getName()
Get the name of this pipe. Guaranteed non-null.

Returns:
String the name of this pipe

getPrevious

public Pipe[] getPrevious()
Get all the upstream pipes this pipe is connected to. This method will return the Pipe instances passed on the constructors as inputs to this Pipe instance.

Returns:
all the upstream pipes this pipe is connected to.

getHeads

public Pipe[] getHeads()
Method getHeads returns the first Pipe instances in this pipe assembly.

Returns:
the first (type Pipe[]) of this Pipe object.

outgoingScopeFor

public Scope outgoingScopeFor(Set<Scope> incomingScopes)
Description copied from interface: FlowElement
Method outgoingScopeFor returns the Scope this FlowElement hands off to the next FlowElement.

Specified by:
outgoingScopeFor in interface FlowElement
Parameters:
incomingScopes - of type Set
Returns:
Scope
See Also:
FlowElement.outgoingScopeFor(java.util.Set)

resolveIncomingOperationFields

public Fields resolveIncomingOperationFields(Scope incomingScope)
Description copied from interface: FlowElement
Method resolveIncomingOperationFields resolves the incoming scopes to the actual incoming operation field names.

Specified by:
resolveIncomingOperationFields in interface FlowElement
Parameters:
incomingScope - of type Scope
Returns:
Fields
See Also:
FlowElement.resolveIncomingOperationFields(cascading.flow.Scope)

resolveFields

public Fields resolveFields(Scope scope)
Description copied from interface: FlowElement
Method resolveFields returns the actual field names represented by the given Scope. The scope may be incoming or outgoing in relation to this FlowElement instance.

Specified by:
resolveFields in interface FlowElement
Parameters:
scope - of type Scope
Returns:
Fields
See Also:
FlowElement.resolveFields(Scope)

getTrace

public String getTrace()
Method getTrace returns a String that pinpoint where this instance was created for debugging.

Returns:
String

toString

public String toString()
Overrides:
toString in class Object

isEquivalentTo

public boolean isEquivalentTo(FlowElement element)
Specified by:
isEquivalentTo in interface FlowElement

equals

public boolean equals(Object object)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

print

public String print(Scope scope)
Method print is used internally.

Parameters:
scope - of type Scope
Returns:
String

printInternal

protected void printInternal(StringBuffer buffer,
                             Scope scope)


Copyright © 2007-2010 Concurrent, Inc. All Rights Reserved.