wyvern.lib.predicates
Class ShortDescMatchPredicate

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

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

A very simple version of the NameMatchPredicate that checks whether the object's toString() description matches the specified string, by looking to see if the match is a substring of the description. Case-insensitive.

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

Constructor Summary
ShortDescMatchPredicate(java.lang.String match)
           
 
Method Summary
 boolean predicate(GameObject o)
          Returns true if the match string is a substring of the object's short (toString()) description.
 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

ShortDescMatchPredicate

public ShortDescMatchPredicate(java.lang.String match)
Method Detail

predicate

public boolean predicate(GameObject o)
Returns true if the match string is a substring of the object's short (toString()) description.

Specified by:
predicate in interface Predicate
Parameters:
o - the object to test
Returns:
o.toString().toLowerCase().indexOf ( match ) != -1

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