com.tinkerpop.pipes.Pipe Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pipes Show documentation
Show all versions of pipes Show documentation
Pipes is a dataflow framework written in Java that enables the splitting, merging, filtering, and
transformation of data from input to output.
Computations are expressed using a combinator model and are evaluated in a memory-efficient, lazy fashion.
package com.tinkerpop.pipes;
import java.util.Iterator;
import java.util.List;
/**
* The generic interface for any Pipe implementation.
* A Pipe takes/consumes objects of type S and returns/emits objects of type E.
* S refers to starts and the E refers to ends.
*
* @author Marko A. Rodriguez (http://markorodriguez.com)
* @author Darrick Wiebe ([email protected])
*/
public interface Pipe extends Iterator, Iterable {
public static final String NO_PATH_MESSAGE = "Path calculations are not enabled";
/**
* Set an iterator of S objects to the head (start) of the pipe.
*
* @param starts the iterator of incoming objects
*/
public void setStarts(Iterator starts);
/**
* Set an iterable of S objects to the head (start) of the pipe.
*
* @param starts the iterable of incoming objects
*/
public void setStarts(Iterable starts);
/**
* Returns the transformation path to arrive at the current object of the pipe.
*
* @return a List of all of the objects traversed for the current iterator position of the pipe.
*/
public List getCurrentPath();
/**
* Calculating paths can be an expensive operation for some pipes.
* This method is used to activate or deactivate the calculation of paths.
* The default state of a newly constructed pipe should have its path calculations disabled.
* An implementation of this method should be recursive whereby the starts (if a Pipe) should have this method called on it.
*
* @param enable enable path calculations
*/
public void enablePath(boolean enable);
/**
* A pipe may maintain state. Reset is used to remove state.
* The general use case for reset() is to reuse a pipe in another computation without having to create a new Pipe object.
* An implementation of this method should be recursive whereby the starts (if a Pipe) should have this method called on it.
*/
public void reset();
}