Interface Grepper<E>

All Known Implementing Classes:
Grepper.ANDGrepper, Grepper.InverseGrepper, Grepper.NULLGrepper, Grepper.ONEGrepper, Grepper.ORGrepper, Grepper.RegexGrepper

public interface Grepper<E>

A grep condition. Classes implementing this interface provide a decision if particular elements should be part of the result list of a grep process. See the grep family of functions in Collections.

A grepper has no state. That is, the result of the grep(Object) decision is based solely on the element passed, not on when it is tested. In other words, the outcome does not depend, for example, on it's position in the input list, and the result must be consistently the same for multiple invocations, provided no relevant information in the element is modified.

Nested Class Summary
static class Grepper.ANDGrepper<E>
          A Grepper that chains multiple client greppers logical-AND-wise.
static class Grepper.InverseGrepper<E>
          A Grepper that inverts the results of another grepper.
static class Grepper.NULLGrepper<E>
          A Grepper that rejects all elements, producing an empty result list.
static class Grepper.ONEGrepper<E>
          A Grepper that lets all elements pass.
static class Grepper.ORGrepper<E>
          A Grepper that chains multiple client greppers logical-OR-wise.
static class Grepper.RegexGrepper
          A Grepper that matches string-like elements against a regular expression.
Method Summary
 boolean grep(E element)
          Decides if the element in question should be part of the results of a grep process.

Method Detail


boolean grep(E element)
Decides if the element in question should be part of the results of a grep process.

element - The element under test.
true if the element matches the grep condition, thus should be added to the results, otherwise false.