|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.jga.fn.Functor<R> net.sf.jga.fn.UnaryFunctor<T,java.lang.Boolean> net.sf.jga.fn.comparison.Between<T>
public class Between<T>
Unary Predicate that returns TRUE when its argument is between two given values. By default, the range is inclusive: a constructor is provided that allows client code to supply two predicates that can create exclusive ranges. The comparison is performed using a comparator or a pair of functors supplied at construction time: 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.
Copyright © 2003-2005 David A. Hall
Nested Class Summary | |
---|---|
static class |
Between.Comparable<T extends java.lang.Comparable<? super T>>
Between functor for use with Comparable arguments. |
static interface |
Between.Visitor
Interface for classes that may interpret an Between predicate. |
Constructor Summary | |
---|---|
Between(T lo,
T hi,
java.util.Comparator<? super T> comp)
Builds a Between predicate that returns TRUE when its argument is between its two arguments (inclusive). |
|
Between(UnaryFunctor<T,java.lang.Boolean> lo,
UnaryFunctor<T,java.lang.Boolean> hi)
Builds a Between predicate that returns TRUE when both of the given predicates return TRUE for the same argument. |
Method Summary | |
---|---|
void |
accept(Visitor v)
Calls the Visitor's visit(Between) method, if it
implements the nested Visitor interface. |
java.lang.Boolean |
fn(T x)
Given argument x, returns TRUE if x is between lo and hi. |
java.lang.String |
toString()
|
Methods inherited from class net.sf.jga.fn.UnaryFunctor |
---|
bind, bind0th, bindNth, compose, compose, compose, composeNth, composeNth, eval, generate, generateNth |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Between(T lo, T hi, java.util.Comparator<? super T> comp)
java.lang.IllegalArgumentException
- when either argument is null or when
lo > hipublic Between(UnaryFunctor<T,java.lang.Boolean> lo, UnaryFunctor<T,java.lang.Boolean> hi)
Method Detail |
---|
public java.lang.Boolean fn(T x)
fn
in class UnaryFunctor<T,java.lang.Boolean>
public void accept(Visitor v)
visit(Between)
method, if it
implements the nested Visitor interface.
accept
in interface Visitable
accept
in class Functor<java.lang.Boolean>
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |