org.jcreme.filters
Class LikeStringFilter

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

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

A filter that filters strings based on a comparison operator (which can basically be LIKE or NOT_LIKE) , and a stem that given strings have to be 'like' or 'not like'.

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

Field Summary
(package private) static long serialVersionUID
           
 
Constructor Summary
LikeStringFilter(StringComparisonOperator op, java.lang.String stem)
          Creates new LikeStringComparator
 
Method Summary
 boolean accept(java.lang.Object obj)
          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.
 ComparisonOperator getOperator()
          Gives access to the comparison operator used by the filter.
 java.lang.String getStem()
          Gives access to the stem used by 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 a 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

LikeStringFilter

public LikeStringFilter(StringComparisonOperator op,
                        java.lang.String stem)
                 throws java.lang.IllegalArgumentException
Creates new LikeStringComparator

Parameters:
op - The operator to be applied.
stem - The stem to be used to filter strings.
Throws:
java.lang.IllegalArgumentException - In case any of the passed in parameters is null, which is not wanted here.
Method Detail

accept

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

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

getOperator

public ComparisonOperator getOperator()
Gives access to the comparison operator used by the filter.

Returns:
The comparison operator used by this filter.

getStem

public java.lang.String getStem()
Gives access to the stem used by this filter.

Returns:
The stem used by this filter.

toString

public java.lang.String toString()
Gives a 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 a LikeStringFilter 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()
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
Returns:
the cloned object.


Copyright 2006 null. All Rights Reserved.