7.10 Logical Filter Operators

The logical Filter operators allows the user to assemble more complex filtering to be used in a single Pipe, instead of chaining multiple Pipes together to get the same effect.

And

The cascading.operation.filter.And Filter will logically 'and' the results of the constructor provided Filter instances. Logically, if Filter#isRemove() returns true for all given instances, this filter will returntrue.

Or

The cascading.operation.filter.Or Filter will logically 'or' the results of the constructor provided Filter instances. Logically, if Filter#isRemove() returns true for any of the given instances, this filter will returntrue.

Not

The cascading.operation.filter.Not Filter will logically 'not' (negation) the results of the constructor provided Filter instances. Logically, if Filter#isRemove() returns true for the given instance, this filter will return the opposite,false.

Xor

The cascading.operation.filter.Xor Filter will logically 'xor' (exclusive or) the results of the constructor provided Filter instances. Logically, if Filter#isRemove() returns true for all given instances, or returns false for all given instances, this filter will returntrue. Note that Xor can only be applied to two values.

Example 7.1. Combining Filters

// incoming -> "ip", "time", "method", "event", "status", "size"

FilterNull filterNull = new FilterNull();
RegexFilter regexFilter = new RegexFilter( "(GET|HEAD|POST)" );

And andFilter = new And( filterNull, regexFilter );

assembly = new Each( assembly, new Fields( "method" ), andFilter );

// outgoing -> "ip", "time", "method", "event", "status", "size"

Above, we are "and-ing" the two filters. Both must be satisfied for the data to pass through this one Pipe.

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