org.pf.util
Class ObjectCollectionFilter

java.lang.Object
  extended by org.pf.util.ObjectCollectionFilter
All Implemented Interfaces:
IObjectFilter, ObjectFilter

public class ObjectCollectionFilter
extends java.lang.Object
implements ObjectFilter

This filter returns tru if a given object is contained in the underlying collection of objects. It is possible to specify whether to use equality or identity to determine if an object is in the collection. The default is equality check.

Version:
1.0
Author:
Manfred Duchrow

Constructor Summary
ObjectCollectionFilter(java.util.Collection objects)
          Initialize the new instance with some objects.
ObjectCollectionFilter(java.util.Collection objects, boolean identity)
          Initialize the new instance with some objects.
ObjectCollectionFilter(java.lang.Object[] objects)
          Initialize the new instance with some objects.
ObjectCollectionFilter(java.lang.Object[] objects, boolean identity)
          Initialize the new instance with some objects.
 
Method Summary
 boolean matches(java.lang.Object object)
          Returns true if the given object is in the collection
 void negate()
          This method reverses the logic of the filter.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectCollectionFilter

public ObjectCollectionFilter(java.util.Collection objects)
Initialize the new instance with some objects. The default comparison method is equality.

Parameters:
objects - The object to keep in the filter

ObjectCollectionFilter

public ObjectCollectionFilter(java.util.Collection objects,
                              boolean identity)
Initialize the new instance with some objects.

Parameters:
objects - The object to keep in the filter
identity - If true an identity comparison is done rather than equality check

ObjectCollectionFilter

public ObjectCollectionFilter(java.lang.Object[] objects)
Initialize the new instance with some objects. The default comparison method is equality.

Parameters:
objects - The object to keep in the filter

ObjectCollectionFilter

public ObjectCollectionFilter(java.lang.Object[] objects,
                              boolean identity)
Initialize the new instance with some objects.

Parameters:
objects - The object to keep in the filter
identity - If true an identity comparison is done rather than equality check
Method Detail

matches

public boolean matches(java.lang.Object object)
Returns true if the given object is in the collection

Specified by:
matches in interface IObjectFilter
Parameters:
object - Any object or null

negate

public void negate()
This method reverses the logic of the filter. That is, for all objects matches() returned true before, now matches() returns false and vice versa.