wyvern.lib.predicates
Class HashcodePredicate

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

public class HashcodePredicate
extends java.lang.Object
implements Predicate

Checks an object to see if it's got the right hashcode. A hashcode is an int value that uniquely identifies an object in the game. The hashcode is usually the ONLY way to be 100% sure that the object is the exact one you want, rather than just a lookalike.

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

Constructor Summary
HashcodePredicate(int hashcode)
          Creates a HashcodePredicate with the specified hashcode.
HashcodePredicate(java.lang.String code)
          Constructs a new HashcodePredicate
 
Method Summary
 boolean predicate(GameObject obj)
          Returns true for the object matching the passed hashcode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HashcodePredicate

public HashcodePredicate(int hashcode)
Creates a HashcodePredicate with the specified hashcode.

Parameters:
hashcode - the hashcode to match.

HashcodePredicate

public HashcodePredicate(java.lang.String code)
Constructs a new HashcodePredicate

Parameters:
code - the hashcode as a string
Method Detail

predicate

public boolean predicate(GameObject obj)
Returns true for the object matching the passed hashcode.

Specified by:
predicate in interface Predicate
Parameters:
obj - object to match
Returns:
true if the object has the passed hashcode. Note that hashcodes are not strictly guaranteed to be unique, but it's extremely unlikely that you'll have 2 objects at any given time with the same hashcode (e.g. in your inventory)