cascading.operation.filter
Class Sample

java.lang.Object
  extended by cascading.operation.BaseOperation<Random>
      extended by cascading.operation.filter.Sample
All Implemented Interfaces:
Filter<Random>, Operation<Random>, Serializable

public class Sample
extends BaseOperation<Random>
implements Filter<Random>

Class Sample is a Filter that only allows the given percent of Tuple instances to pass.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class cascading.operation.BaseOperation
fieldDeclaration, numArgs, trace
 
Fields inherited from interface cascading.operation.Operation
ANY
 
Constructor Summary
Sample(double percent)
          Creates a new Sample that permits percent Tuples to pass.
Sample(long seed, double percent)
          Creates a new Sample that permits percent Tuples to pass.
 
Method Summary
 boolean isRemove(FlowProcess flowProcess, FilterCall<Random> filterCall)
          Method isRemove returns true if input should be removed from the tuple stream.
 void prepare(FlowProcess flowProcess, OperationCall<Random> operationCall)
          Method prepare does nothing, and may safely be overridden.
 
Methods inherited from class cascading.operation.BaseOperation
cleanup, getFieldDeclaration, getNumArgs, getTrace, printOperationInternal, toString, toStringInternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface cascading.operation.Operation
cleanup, getFieldDeclaration, getNumArgs
 

Constructor Detail

Sample

public Sample(double percent)
Creates a new Sample that permits percent Tuples to pass.

Parameters:
percent - of type double

Sample

public Sample(long seed,
              double percent)
Creates a new Sample that permits percent Tuples to pass. The given seed value seeds the random number generator.

Parameters:
seed - of type long
percent - of type double
Method Detail

prepare

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

Specified by:
prepare in interface Operation<Random>
Overrides:
prepare in class BaseOperation<Random>

isRemove

public boolean isRemove(FlowProcess flowProcess,
                        FilterCall<Random> 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<Random>
Parameters:
flowProcess - of type FlowProcess
filterCall - of type FilterCall
Returns:
boolean


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