inonit.domain.game.card
Class Rank

java.lang.Object
  |
  +--inonit.domain.game.card.Rank
All Implemented Interfaces:
java.io.Serializable

public class Rank
extends java.lang.Object
implements java.io.Serializable

A number or value of a particular Card. Ranks are conceptually values; two Ranks with the same value are interchangeable. Rank objects are immutable.

Thirteen Rank instances representing the normal values of playing cards are defined as public static final and are not individually documented.

Different card games have different rules about what Ranks are highest; the two most common are defined as static variables in the Rank.Order class.

See Also:
Serialized Form

Inner Class Summary
static class Rank.Order
          A logical ordering for Ranks; can be used to sort arrays of Cards and CardArray objects via the Sort.Orders returned by getAscendingOrder and getDescendingOrder, in conjunction with CardArray's sort method.
 
Field Summary
static Rank ACE
           
static Rank EIGHT
           
static Rank FIVE
           
static Rank FOUR
           
static Rank JACK
           
static Rank KING
           
static Rank NINE
           
static Rank QUEEN
           
static Rank SEVEN
           
static Rank SIX
           
static Rank TEN
           
static Rank THREE
           
static Rank TWO
           
 
Method Summary
 boolean equals(java.lang.Object o)
          Returns whether this Rank is equal to the given object.
 char getAbbreviation()
          Returns an abbreviation representing the value of this Rank.
 java.lang.String getName()
          Returns a string representing the value of this Rank.
 int hashCode()
          Returns a hash code for this object.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ACE

public static Rank ACE

KING

public static Rank KING

QUEEN

public static Rank QUEEN

JACK

public static Rank JACK

TEN

public static Rank TEN

NINE

public static Rank NINE

EIGHT

public static Rank EIGHT

SEVEN

public static Rank SEVEN

SIX

public static Rank SIX

FIVE

public static Rank FIVE

FOUR

public static Rank FOUR

THREE

public static Rank THREE

TWO

public static Rank TWO
Method Detail

toString

public java.lang.String toString()
Returns a string representation of this object.
Overrides:
toString in class java.lang.Object
Returns:
A string representation of this object, e.g., "Rank: King" for Rank.KING, which may be useful for debugging.

equals

public boolean equals(java.lang.Object o)
Returns whether this Rank is equal to the given object.
Overrides:
equals in class java.lang.Object
Parameters:
o - the object to which to compare this Rank.
Returns:
true if the given object is a Rank and has the same value as this Rank; false otherwise.

hashCode

public int hashCode()
Returns a hash code for this object.
Overrides:
hashCode in class java.lang.Object
Returns:
A hash code for this object consistent with equals.

getName

public java.lang.String getName()
Returns a string representing the value of this Rank.
Returns:
A String representing the value of this Rank, e.g., "2", "10", "King".

getAbbreviation

public char getAbbreviation()
Returns an abbreviation representing the value of this Rank.
Returns:
A character representing the value of this Rank, e.g., '2', '4', 'T' (for Rank.TEN), 'Q', 'A'.