net.sf.jga.fn.comparison
Class GreaterEqual<T>

java.lang.Object
  extended by net.sf.jga.fn.Functor<R>
      extended by net.sf.jga.fn.BinaryFunctor<T,T,java.lang.Boolean>
          extended by net.sf.jga.fn.comparison.GreaterEqual<T>
All Implemented Interfaces:
java.io.Serializable, Visitable
Direct Known Subclasses:
GreaterEqual.Comparable

public class GreaterEqual<T>
extends BinaryFunctor<T,T,java.lang.Boolean>

Binary Predicate that returns TRUE for arguments x and y when x >= y. The comparison is performed using a comparator supplied at construction time, although a default comparator will be used if the nested Comparable class' default constructor is used. 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.

To serialize a GreaterEqual, the comparator passed at construction must be Serializable.

Copyright © 2002-2005 David A. Hall

Author:
David A. Hall
See Also:
Serialized Form

Nested Class Summary
static class GreaterEqual.Comparable<T extends java.lang.Comparable<? super T>>
          GreaterEqual predicate for use with Comparable arguments.
static interface GreaterEqual.Visitor
          Interface for classes that may interpret a GreaterEqual predicate.
 
Constructor Summary
GreaterEqual(java.util.Comparator<? super T> comp)
          Builds a GreaterEqual predicate using the given Comparator
 
Method Summary
 void accept(Visitor v)
          Calls the Visitor's visit(GreaterEqual) method, if it implements the nested Visitor interface.
 java.lang.Boolean fn(T x, T y)
          Given Comparable arguments x and y, returns x >= y.
 java.util.Comparator<? super T> getComparator()
          Returns the comparator in use by this functor
 java.lang.String toString()
           
 
Methods inherited from class net.sf.jga.fn.BinaryFunctor
bind, bind0th, bind1st, bind2nd, bindNth, compose, compose, composeNth, distribute, eval, generate, generate1st, generate2nd, generateNth
 
Methods inherited from class net.sf.jga.fn.Functor
composeNth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GreaterEqual

public GreaterEqual(java.util.Comparator<? super T> comp)
Builds a GreaterEqual predicate using the given Comparator

Throws:
java.lang.IllegalArgumentException - if the argument is null
Method Detail

getComparator

public java.util.Comparator<? super T> getComparator()
Returns the comparator in use by this functor

Returns:
the comparator in use by this functor

fn

public java.lang.Boolean fn(T x,
                            T y)
Given Comparable arguments x and y, returns x >= y.

Specified by:
fn in class BinaryFunctor<T,T,java.lang.Boolean>
Returns:
x >= y
Throws:
java.lang.NullPointerException - if either argument is null

accept

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

Specified by:
accept in interface Visitable
Overrides:
accept in class Functor<java.lang.Boolean>

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2002-2006 David A. Hall. All Rights Reserved.