wyvern.lib.predicates
Class UserTypePredicate

java.lang.Object
  extended bywyvern.lib.predicates.UserTypePredicate
All Implemented Interfaces:
Predicate, PrintablePredicate

public class UserTypePredicate
extends java.lang.Object
implements Predicate, PrintablePredicate

A predicate that checks whether an object is of a certain "user type", which is basically any boolean property on the object. In practice, we only look for certain types, such as "wand", "sword", "coins", and so on.

Version:
1.0, Dec 27, 2003
Author:
Steve Yegge

Constructor Summary
UserTypePredicate(java.lang.String type)
          Constructs a new UserTypePredicate for the specified type.
 
Method Summary
 java.lang.String getType()
           
 boolean predicate(GameObject obj)
          Checks an object to see if it passes the predicate.
 java.lang.String print()
          Prints an English-like description of the predicate, e.g.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UserTypePredicate

public UserTypePredicate(java.lang.String type)
Constructs a new UserTypePredicate for the specified type.

Method Detail

getType

public java.lang.String getType()

predicate

public boolean predicate(GameObject obj)
Description copied from interface: Predicate
Checks an object to see if it passes the predicate.

Specified by:
predicate in interface Predicate
Parameters:
obj - any GameObject
Returns:
true if the object passes, else false

toString

public java.lang.String toString()

print

public java.lang.String print()
Description copied from interface: PrintablePredicate
Prints an English-like description of the predicate, e.g. "NOT name like 'bob'", or "quantity < 100 AND item is cursed"

Specified by:
print in interface PrintablePredicate