net.sf.jga.fn.comparison

Class GreaterComp<T>

public class GreaterComp<T> extends AbstractBinaryPredicate<T,T> implements 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
interfaceGreaterComp.Visitor
Interface for classes that may interpret a GreaterComp predicate.
Constructor Summary
GreaterComp(Comparator<T> comp)
Builds the GreaterComp predicate using the given Comparator
Method Summary
voidaccept(Visitor v)
Calls the Visitor's visit(GreaterComp) method, if it implements the nested Visitor interface.
Comparator<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

GreaterComp

public GreaterComp(Comparator<T> comp)
Builds the GreaterComp 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(GreaterComp) method, if it implements the nested Visitor interface.

getComparator

public Comparator<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()