cascading.operation.regex
Class RegexFilter

java.lang.Object
  extended by cascading.operation.BaseOperation<C>
      extended by cascading.operation.regex.RegexOperation<Matcher>
          extended by cascading.operation.regex.RegexMatcher
              extended by cascading.operation.regex.RegexFilter
All Implemented Interfaces:
DeclaresResults, Filter<Matcher>, Operation<Matcher>, Traceable, Serializable

public class RegexFilter
extends RegexMatcher
implements Filter<Matcher>

Class RegexFilter will apply the regex patternString against every input Tuple value and filter the Tuple stream accordingly.

By default, Tuples that match the given pattern are kept, and Tuples that do not match are filtered out. This can be changed by setting removeMatch to true.

Also, by default, the whole Tuple is matched against the given patternString (tab delimited). If matchEachElement is set to true, the pattern is applied to each Tuple value individually.

This operation uses Matcher internally, specifically the method Matcher.find().

Note a null valued argument passed to the parser will be converted to an empty string ("") before the regex is applied.

Any Object value will be coerced to a String type via its toString() method.

See Also:
Matcher, Pattern, Serialized Form

Field Summary
protected  boolean matchEachElement
          Field matchEachElement
 
Fields inherited from class cascading.operation.regex.RegexMatcher
negateMatch
 
Fields inherited from class cascading.operation.regex.RegexOperation
patternString
 
Fields inherited from class cascading.operation.BaseOperation
fieldDeclaration, numArgs, trace
 
Fields inherited from interface cascading.operation.Operation
ANY
 
Constructor Summary
RegexFilter(String patternString)
          Constructor RegexFilter creates a new RegexFilter instance.
RegexFilter(String patternString, boolean removeMatch)
          Constructor RegexFilter creates a new RegexFilter instance.
RegexFilter(String patternString, boolean removeMatch, boolean matchEachElement)
           
 
Method Summary
 boolean equals(Object object)
           
 int hashCode()
           
 boolean isMatchEachElement()
           
 boolean isRemove(FlowProcess flowProcess, FilterCall<Matcher> filterCall)
          Method isRemove returns true if input should be removed from the tuple stream.
 
Methods inherited from class cascading.operation.regex.RegexMatcher
isNegateMatch, matchEachElement, matchEachElement, matchEachElementPos, matchEachElementPos, matchWholeTuple, matchWholeTuple, prepare
 
Methods inherited from class cascading.operation.regex.RegexOperation
getPattern, getPatternString
 
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, prepare
 

Field Detail

matchEachElement

protected final boolean matchEachElement
Field matchEachElement

Constructor Detail

RegexFilter

@ConstructorProperties(value="patternString")
public RegexFilter(String patternString)
Constructor RegexFilter creates a new RegexFilter instance.

Parameters:
patternString - of type String

RegexFilter

@ConstructorProperties(value={"patternString","removeMatch"})
public RegexFilter(String patternString,
                                              boolean removeMatch)
Constructor RegexFilter creates a new RegexFilter instance.

Parameters:
patternString - of type String
removeMatch - of type boolean

RegexFilter

@ConstructorProperties(value={"patternString","removeMatch","matchEachElement"})
public RegexFilter(String patternString,
                                              boolean removeMatch,
                                              boolean matchEachElement)
Parameters:
patternString - of type String
removeMatch - of type boolean, set to true if a match should be filtered
matchEachElement - of type boolean, set to true if each element should be matched individually
Method Detail

isMatchEachElement

public boolean isMatchEachElement()

isRemove

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

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class RegexMatcher


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