wyvern.lib.predicates
Class PropertyPredicate

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

public class PropertyPredicate
extends java.lang.Object
implements Predicate

Checks the object for the presence of a specified property, or any property from a specified list. Considers the property not to be present if its value is null, false, or zero, unless it's a "tag" property with no value.

Version:
1.0, Nov 20, 1997
Author:
Steve Yegge

Field Summary
protected  java.lang.String[] properties_
           
 
Constructor Summary
PropertyPredicate()
           
PropertyPredicate(java.lang.String prop)
          Constructs a new PropertyPredicate for a given property.
PropertyPredicate(java.lang.String[] props)
          Constructs a new PropertyPredicate for an array of strings.
 
Method Summary
 boolean predicate(GameObject obj)
          Return true if the passed object has one of the listed properties.
 void setProperty(java.lang.String propertyName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

properties_

protected java.lang.String[] properties_
Constructor Detail

PropertyPredicate

public PropertyPredicate()

PropertyPredicate

public PropertyPredicate(java.lang.String prop)
Constructs a new PropertyPredicate for a given property.

Parameters:
prop - the name of the property in question

PropertyPredicate

public PropertyPredicate(java.lang.String[] props)
Constructs a new PropertyPredicate for an array of strings.

Parameters:
props - an array of property names for which to return 'true', if the property is found and has a non-default value.
Method Detail

setProperty

public void setProperty(java.lang.String propertyName)

predicate

public boolean predicate(GameObject obj)
Return true if the passed object has one of the listed properties.

Specified by:
predicate in interface Predicate
Parameters:
obj - any GameObject
Returns:
true if it has a non-default value for one of the properties specified in the constructor for this Predicate.