|
|||||||||
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.property.CompareProperty<T,V>
public class CompareProperty<T,V>
Unary Predicate that compares the value of the named property to the given value. The type of comparison is a binary predicate: the two arguments passed to the predicate are the value of the argument's property in the first position and the constant value passed at construction in the second position.
The test returns
bp(getProperty(name).fn(arg), value)
. This is also
equivalent to the following:
UnaryPredicate CompareProperty = new UnaryCompose(new Binder2nd(bp, value), new GetProperty(propName))with one less call to
fn
at evaluation and somewhat clearer
construction syntax.
To Serialize a CompareProperty, the generic parameter V must be serializable.
Copyright © 2003-2005 David A. Hall
Nested Class Summary | |
---|---|
static interface |
CompareProperty.Visitor
Interface for classes that may interpret a CompareProperty predicate. |
Constructor Summary | |
---|---|
CompareProperty(java.lang.Class<T> argType,
java.lang.String propName,
BinaryFunctor<V,V,java.lang.Boolean> pred,
V val)
Builds the CompareProperty predicate that will compare the named property of an instance of type argType to the given value. |
|
CompareProperty(java.lang.Class<T> argType,
java.lang.String propName,
V val)
Builds the CompareProperty predicate that will compare the named property of an instance of type argType to the given value using an EqualTo predicate. |
Method Summary | |
---|---|
void |
accept(Visitor v)
Calls the Visitor's visit(CompareProperty) method, if it
implements the nested Visitor interface. |
java.lang.Boolean |
fn(T arg)
Tests the designated property of the argument against the value given at construction. |
BinaryFunctor<V,V,java.lang.Boolean> |
getPredicate()
Returns the predicate used to compare property values |
java.lang.String |
getPropName()
Returns the name of the property to be compared |
V |
getValue()
Returns the constant value to which properties are compared |
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 CompareProperty(java.lang.Class<T> argType, java.lang.String propName, V val)
public CompareProperty(java.lang.Class<T> argType, java.lang.String propName, BinaryFunctor<V,V,java.lang.Boolean> pred, V val)
Method Detail |
---|
public java.lang.String getPropName()
public V getValue()
public BinaryFunctor<V,V,java.lang.Boolean> getPredicate()
public java.lang.Boolean fn(T arg)
fn
in class UnaryFunctor<T,java.lang.Boolean>
public void accept(Visitor v)
visit(CompareProperty)
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 |