Class Grepper.ANDGrepper<E>

  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<Grepper<E>>
              extended by org.tbull.util.Grepper.ANDGrepper<E>
All Implemented Interfaces:
Serializable, Cloneable, Iterable<Grepper<E>>, Collection<Grepper<E>>, List<Grepper<E>>, RandomAccess, Grepper<E>
Enclosing interface:

public static class Grepper.ANDGrepper<E>
extends ArrayList<Grepper<E>>
implements Grepper<E>

A Grepper that chains multiple client greppers logical-AND-wise. Greps elements that are grepped by all client greppers. Rejects elements that are rejected by at least one of the client greppers.

Since this is a List, you add client greppers by using the List method List.add(Object). However, do not rely on this class to inherit from a specific List implementation (such as ArrayList), as this may change in the future.

Invokes the client greppers in the order stored in this list. From a performance point of view it is best to add greppers first that are most likely to reject most of the tested elements.

See Also:
Grepper.ORGrepper, Serialized Form

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
Method Summary
 boolean grep(E element)
          Returns false if any of the client greppers returns false.
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, set, size, toArray, toArray, trimToSize
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
Methods inherited from class Object
getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList

Constructor Detail


public Grepper.ANDGrepper()
Method Detail


public boolean grep(E element)
Returns false if any of the client greppers returns false. Returns true if all client greppers return true.

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.