|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.lib.predicates.NameMatchPredicate
This class tests to see if the passed object's name matches a specified string. This is useful for finding the first object that matches some string the user types, e.g. "get sign" or "look at horse".
The matcher first looks for a short-description property, then a long-description, and failing to match these converts the class name.
Constructor Summary | |
NameMatchPredicate(java.lang.String match)
Constructs a new NameMatchPredicate. |
Method Summary | |
static boolean |
matches(java.lang.String m,
GameObject obj)
Returns true if the passed object matches the passed description. |
boolean |
predicate(GameObject obj)
Returns true if our match-string is found in the passed Object's description. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public NameMatchPredicate(java.lang.String match)
match
- the string to match in an object's description,
insensitive of case.Method Detail |
public boolean predicate(GameObject obj)
predicate
in interface Predicate
obj
- any GameObject
public static boolean matches(java.lang.String m, GameObject obj)
obj
- the GameObject to checkm
- the name to match against the obj's description,
using the same algorithm as is used in the predicate() method.public java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |