org.jcreme.filters
Class InclusionFilter

java.lang.Object
  extended byorg.jcreme.filters.InclusionFilter
All Implemented Interfaces:
java.lang.Cloneable, Filter, java.io.Serializable

public class InclusionFilter
extends java.lang.Object
implements Filter, java.io.Serializable

A filters that tests the inclusion (or non-inclusion) of the tested object in a set of accepted values.

Version:
$Revision: 1.3 $
Author:
$Author: dbregeon $
See Also:
Serialized Form

Field Summary
(package private) static long serialVersionUID
           
 
Constructor Summary
InclusionFilter(InclusionComparisonOperator op, java.lang.Object[] list)
          Creates new InclusionComparator
 
Method Summary
 boolean accept(java.lang.Object o)
          Tells whether the given object 'passes' the filter or not.
 java.lang.Object clone()
          This forces override of the Object class clone method. it makes a deep copy so a change in a subfilter does not affect the cloned version.
 boolean equals(java.lang.Object o)
          Overloads the 'dummy' implementation in Object, so that it returns true only if the passed in parameter is a filter of the same kind as this one, and accepts exactly the same objects.
 java.lang.Object[] getAcceptedValues()
          This method enables access to the list of values that are admissible through the filter.
 ComparisonOperator getOperator()
          This method enables access to the comparison operator used in this filter.
 int hashCode()
          Overloads the 'dummy' implementation in Object so that it fulfills the implicit hashCode contract, i.e. same filters have the same hashCode and different ones have different hashCodes.
 java.lang.String toString()
          Gives an SQL-like string representation of this filter.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

InclusionFilter

public InclusionFilter(InclusionComparisonOperator op,
                       java.lang.Object[] list)
                throws java.lang.IllegalArgumentException
Creates new InclusionComparator

Parameters:
op - The inclusion operator to be used.
list - The set of accepted values.
Throws:
java.lang.IllegalArgumentException - In case one of the passed in parameters is null, which is not wanted here.
Method Detail

accept

public boolean accept(java.lang.Object o)
Tells whether the given object 'passes' the filter or not.

Specified by:
accept in interface Filter
Parameters:
o - The object you want to 'test'.
Returns:
True if the passed in parameter is accepted by the filter, false otherwise.

getAcceptedValues

public java.lang.Object[] getAcceptedValues()
This method enables access to the list of values that are admissible through the filter.

Returns:
an array containing the values.

getOperator

public ComparisonOperator getOperator()
This method enables access to the comparison operator used in this filter.

Returns:
the operator.

toString

public java.lang.String toString()
Gives an SQL-like string representation of this filter.

Returns:
the string representation of the filter.

equals

public boolean equals(java.lang.Object o)
Overloads the 'dummy' implementation in Object, so that it returns true only if the passed in parameter is a filter of the same kind as this one, and accepts exactly the same objects.

Parameters:
o - The object to be compared to this one.
Returns:
True if the passed in object is an InclusionFilter that accepts exactly the same objects as this one.

hashCode

public int hashCode()
Overloads the 'dummy' implementation in Object so that it fulfills the implicit hashCode contract, i.e. same filters have the same hashCode and different ones have different hashCodes.

Returns:
The hash code for this filter.

clone

public java.lang.Object clone()
Description copied from interface: Filter
This forces override of the Object class clone method. it makes a deep copy so a change in a subfilter does not affect the cloned version.

Specified by:
clone in interface Filter
See Also:
Object.clone()


Copyright 2006 null. All Rights Reserved.