Class Grepper.InverseGrepper<E>

  extended by org.tbull.util.Grepper.InverseGrepper<E>
All Implemented Interfaces:
Enclosing interface:

public static class Grepper.InverseGrepper<E>
extends Object
implements Grepper<E>

A Grepper that inverts the results of another grepper. If you have a Grepper and you need exactly the inverse results (i.e. you want to grep the elements your grepper rejects and want to reject the elements your grepper accepts), then wrap this one around the original grepper.

  Grepper<X> your_grepper;
  results = grep(new InverseGrepper<X>(your_grepper), input...);

Nested Class Summary
Nested classes/interfaces inherited from interface org.tbull.util.Grepper
Grepper.ANDGrepper<E>, Grepper.InverseGrepper<E>, Grepper.NULLGrepper<E>, Grepper.ONEGrepper<E>, Grepper.ORGrepper<E>, Grepper.RegexGrepper
Constructor Summary
Grepper.InverseGrepper(Grepper<E> grepper)
Method Summary
 boolean grep(E element)
          Returns true if the wrapped grepper returns false, and vice versa.
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public Grepper.InverseGrepper(Grepper<E> grepper)
Method Detail


public boolean grep(E element)
Returns true if the wrapped grepper returns false, and vice versa.

Specified by:
grep in interface Grepper<E>
element - The element under test.
true if the element matches the grep condition, thus should be added to the results, otherwise false.