Class Limit

  extended by cascading.operation.BaseOperation<Limit.Context>
      extended by cascading.operation.filter.Limit
All Implemented Interfaces:
DeclaresResults, Filter<Limit.Context>, Operation<Limit.Context>, Traceable, Serializable

public class Limit
extends BaseOperation<Limit.Context>
implements Filter<Limit.Context>

Class Limit is a Filter that will limit the number of Tuple instances that it will allow to pass.
Note that the limit value is roughly a suggestion. It attempts to divide the limit number by the number of concurrent tasks, but knowing the number of tasks isn't easily available from configuration information provided to individual tasks. Further, the number of records/lines available to a task may be less than the limit amount.
More consistent results will be received from using Sample.

See Also:
Sample, Serialized Form

Nested Class Summary
static class Limit.Context
Field Summary
Fields inherited from class cascading.operation.BaseOperation
fieldDeclaration, numArgs, trace
Fields inherited from interface cascading.operation.Operation
Constructor Summary
Limit(long limit)
          Creates a new Limit class that only allows limit number of Tuple instances to pass.
Method Summary
 boolean equals(Object object)
 long getLimit()
 int hashCode()
 boolean isRemove(FlowProcess flowProcess, FilterCall<Limit.Context> filterCall)
          Method isRemove returns true if input should be removed from the tuple stream.
 void prepare(FlowProcess flowProcess, OperationCall<Limit.Context> operationCall)
          Method prepare does nothing, and may safely be overridden.
Methods inherited from class cascading.operation.BaseOperation
cleanup, flush, getFieldDeclaration, getNumArgs, getTrace, isSafe, printOperationInternal, toString, toStringInternal
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface cascading.operation.Operation
cleanup, flush, getFieldDeclaration, getNumArgs, isSafe

Constructor Detail


public Limit(long limit)
Creates a new Limit class that only allows limit number of Tuple instances to pass.

limit - the number of tuples to let pass
Method Detail


public long getLimit()


public void prepare(FlowProcess flowProcess,
                    OperationCall<Limit.Context> operationCall)
Description copied from class: BaseOperation
Method prepare does nothing, and may safely be overridden.

Specified by:
prepare in interface Operation<Limit.Context>
prepare in class BaseOperation<Limit.Context>


public boolean isRemove(FlowProcess flowProcess,
                        FilterCall<Limit.Context> filterCall)
Description copied from interface: Filter
Method isRemove returns true if input should be removed from the tuple stream.

Specified by:
isRemove in interface Filter<Limit.Context>
flowProcess - of type FlowProcess
filterCall - of type FilterCall


public boolean equals(Object object)
equals in class BaseOperation<Limit.Context>


public int hashCode()
hashCode in class BaseOperation<Limit.Context>

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