|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.lib.predicates.ClassPredicate
This Predicate checks to see if the passed object is an instance of the specified class. This class is thread-safe.
Big Fat Note: This class does NOT work in jython, because of the proxy classes prevent Class.isInstance() from working correctly. However, you can create your own using jython's built-in isinstance operator:
class open_predicate(Predicate): def predicate(self, obj): return isinstance(obj, Openable)
Constructor Summary | |
ClassPredicate()
Constructs a new ClassPredicate with no predicate classes. |
|
ClassPredicate(java.lang.Class c)
Constructs a new ClassPredicate with the specified class. |
Method Summary | |
void |
addClass(java.lang.Class c)
Adds a class to check for. |
boolean |
predicate(GameObject obj)
Return true if the object is an instance of the class. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ClassPredicate()
public ClassPredicate(java.lang.Class c)
c
- a class for which the predicate will return trueMethod Detail |
public void addClass(java.lang.Class c)
c
- a class to add to the list of classes that pass
the predicate.public boolean predicate(GameObject obj)
predicate
in interface Predicate
obj
- the object to check
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |