|
|||||||||
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.InstanceOf<T>
public class InstanceOf<T>
Functor that returns true if the argument is an instance of given type.
NOTE: the generic parm T is not related to the class parameter. If there was such a relationship (ie, if the class paramater given to the constructor was declared-- if it were declared Class<T> rather than Class<?>, then the compiler would require that the arguemnt be of the given type to compile code that uses this functor, eliminating the need for the functor in the first plase. Instead, the generic parm is the class of objects that will be tested.
Copyright © 2004-2005 David A. Hall
Nested Class Summary | |
---|---|
static interface |
InstanceOf.Visitor
Interface for classes that may interpret a InstanceOf function. |
Constructor Summary | |
---|---|
InstanceOf(java.lang.Class<?> cl)
Builds a InstanceOf predicate that tests against the given class. |
Method Summary | |
---|---|
void |
accept(Visitor v)
Calls the Visitor's visit(InstanceOf) method, if it
implements the nested Visitor interface. |
java.lang.Boolean |
fn(T arg)
Executes the function and returns the result. |
java.lang.Class<?> |
getTestClass()
|
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 InstanceOf(java.lang.Class<?> cl)
java.lang.IllegalArgumentException
- if the class is null.Method Detail |
---|
public java.lang.Class<?> getTestClass()
public java.lang.Boolean fn(T arg)
UnaryFunctor
fn
in class UnaryFunctor<T,java.lang.Boolean>
public void accept(Visitor v)
visit(InstanceOf)
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 |