net.sf.jga.fn.comparison

Class EqualComp<T>

public class EqualComp<T> extends AbstractBinaryPredicate<T,T> implements Equality<T>, Serializable

Binary Predicate that returns TRUE for object arguments x and y when x == y as determined by the given Comparator. The behaviour of this class in the presence of null arguments is left to the implementation of the specific Comparator, however it is generally safe to assume that using null arguments will cause a NullPointerException to be thrown.

Copyright © 2002 David A. Hall

Author: David A. Hall

Nested Class Summary
interfaceEqualComp.Visitor
Interface for classes that may interpret a EqualComp predicate.
Constructor Summary
EqualComp(Comparator<? super T> comp)
Builds the EqualComp predicate using the given Comparator
Method Summary
voidaccept(Visitor v)
Calls the Visitor's visit(EqualComp) method, if it implements the nested Visitor interface.
Comparator<? super T>getComparator()
Returns the comparator in use by this predicate
booleanp(T x, T y)
Given arguments x and y, return true when the Comparator determines that x == y.
StringtoString()

Constructor Detail

EqualComp

public EqualComp(Comparator<? super T> comp)
Builds the EqualComp predicate using the given Comparator

Throws: IllegalArgumentException if the argument is null

Method Detail

accept

public void accept(Visitor v)
Calls the Visitor's visit(EqualComp) method, if it implements the nested Visitor interface.

getComparator

public Comparator<? super T> getComparator()
Returns the comparator in use by this predicate

Returns: the comparator in use by this predicate

p

public boolean p(T x, T y)
Given arguments x and y, return true when the Comparator determines that x == y. Whether or not a NullPointerException is thrown if either x or y are null is up to the Comparator

Returns: true when the comparator determines that x != y

toString

public String toString()