rlgamekit.objects
Class Cardinal

java.lang.Object
  extended by rlgamekit.objects.Cardinal

public class Cardinal
extends java.lang.Object

A class made as a key class for map lookup operations. It allows to set the key value, so one Cardinal object can be used for many lookups, without the need to instantiate new key objects all over (as would be needed with Integer keys). Be careful though, not to change the key value of Cardinals that are kept in maps already as keys. It can be used in mixed comparisons with Integer objects.

See Also:
Registry

Constructor Summary
Cardinal(int value)
          Create a new Cardinal with the given value.
 
Method Summary
 boolean equals(java.lang.Object other)
          Cardinals can equal other Cardinals as well as Integers.
 int hashCode()
           
 int intValue()
           
 void set(int value)
          Set a new int value for this Cardinal.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cardinal

public Cardinal(int value)
Create a new Cardinal with the given value.

Parameters:
value - The initial value.
Method Detail

intValue

public int intValue()
Returns:
the int value of this Cardinal.

set

public void set(int value)
Set a new int value for this Cardinal.

Parameters:
value - The new value.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object other)
Cardinals can equal other Cardinals as well as Integers.

Overrides:
equals in class java.lang.Object
Parameters:
other - the object to compare to.
Returns:
true if and only if equal.
See Also:
Integer