wyvern.lib.predicates
Class TypePredicate

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

public class TypePredicate
extends java.lang.Object
implements Predicate

Checks whether an object inherits from a specified Archetype.

Version:
1.0, Oct 26, 2000
Author:
Steve Yegge

Constructor Summary
TypePredicate(java.lang.String type)
          Constructs a new TypePredicate for the specified type.
 
Method Summary
 boolean predicate(GameObject obj)
          Returns true if an object is an "instance" of a specified archetype.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypePredicate

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

Parameters:
type - the path to the archetype, e.g. "objects/treasure/gold_coins" (a system archetype) or "wiz/foobar/misc/quest_item" (a wizard-defined archetype)
Method Detail

predicate

public boolean predicate(GameObject obj)
Returns true if an object is an "instance" of a specified archetype.

Specified by:
predicate in interface Predicate
Parameters:
obj - the object to check
Returns:
true if the archetype path is one of the object's parent archetypes.