wyvern.lib.predicates
Class InstancePredicate

java.lang.Object
  extended bywyvern.lib.predicates.InstancePredicate
All Implemented Interfaces:
Predicate

public class InstancePredicate
extends java.lang.Object
implements Predicate

A predicate to check if the passed object is an instance of the specified archetype.

Version:
1.0, May 19, 2001
Author:
Steve Yegge

Constructor Summary
InstancePredicate(java.lang.String type)
          Constructs a new InstancePredicate
 
Method Summary
 void addType(java.lang.String type)
          Adds another type to check for.
 boolean predicate(GameObject obj)
          Returns true if the passed object is of the archetype type specified in the constructor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstancePredicate

public InstancePredicate(java.lang.String type)
Constructs a new InstancePredicate

Parameters:
type - an archetype, such as "magic/reagent/sulfur".
Method Detail

addType

public void addType(java.lang.String type)
Adds another type to check for. Predicate will return true if the object is of either type.


predicate

public boolean predicate(GameObject obj)
Returns true if the passed object is of the archetype type specified in the constructor.

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