## cascading.operation.filter
Class Limit

    java.lang.Object
      cascading.operation.BaseOperation<Limit.Context>
          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
`ANY`

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

### Limit

    @ConstructorProperties(value="limit")
    public Limit(long limit)

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

  Parameters:
    `limit` - the number of tuples to let pass

Method Detail

### getLimit

    public long getLimit()

### prepare

    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>`
  Overrides:
    `prepare` in class `BaseOperation<Limit.Context>`

### isRemove

    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>`
  Parameters:
    `flowProcess` - of type FlowProcess
    `filterCall` - of type FilterCall
  Returns:
    boolean

### equals

    public boolean equals(Object object)

  Overrides:
    `equals` in class `BaseOperation<Limit.Context>`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `BaseOperation<Limit.Context>`

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