|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectwyvern.lib.predicates.CounterPredicate
This predicate looks for the nth occurrence of a match for some other predicate. The most common usage is to wrap a NameMatchPredicate, so the player can type things like "get key 3" and "put scroll 2 in bag 4".
Note: you have to call reset() to reset this predicate or you can't reuse it.
| Constructor Summary | |
CounterPredicate(Predicate p,
int item)
Constructs a new CounterPredicate. |
|
| Method Summary | |
boolean |
predicate(GameObject obj)
Returns true if the passed item is the nth to match the internal predicate. |
void |
reset()
Resets the internal count so the predicate can be reused. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public CounterPredicate(Predicate p,
int item)
p - the Predicate to use for matchingitem - the item number: a positive number.
Item numbers <= 0 will be ignored, and the counter
will always return null.| Method Detail |
public boolean predicate(GameObject obj)
predicate in interface Predicateobj - the object to check
public void reset()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||