proj2
Class Rank

java.lang.Object
  extended by proj2.Rank

public class Rank
extends java.lang.Object

The Rank class defines each of the 13 ranks of a standard deck of playing cards. Using this class assures that all code refers to the ranks in the same manner. i.e Rank.ACE, Rank.TWO, ... Rank.QUEEN, Rank.KING with no possibility of conflicting representations.

Class Invariant:
The Rank's symbol is a single alpha-numeric character
The Ranks's name is a non-empty string
Rank objects are immutable and unique

Author:
Dennis Frey

Field Summary
static Rank ACE
          The rank ACE
static Rank EIGHT
          The rank EIGHT (8)
static Rank FIVE
          The rank FIVE (5)
static Rank FOUR
          The rank FOUR (4)
static Rank JACK
          The rank JACK
static Rank KING
          The rank KING
static Rank NINE
          The rank NINE (9)
static Rank QUEEN
          The rank QUEEN
static Rank SEVEN
          The rank SEVEN (7)
static Rank SIX
          The rank SIX (6)
static Rank TEN
          The rank TEN (10)
static Rank THREE
          The rank THREE (3)
static Rank TWO
          The rank TWO (2)
 
Method Summary
 boolean equals(Rank otherRank)
          Determines if two Rank objects are equal
 java.lang.String getName()
          Accessor for the Rank's name
 java.lang.String getSymbol()
          Accessor the Rank's symbol
static Rank[] VALUES()
          VALUES A static method to return all ranks
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACE

public static final Rank ACE
The rank ACE


TWO

public static final Rank TWO
The rank TWO (2)


THREE

public static final Rank THREE
The rank THREE (3)


FOUR

public static final Rank FOUR
The rank FOUR (4)


FIVE

public static final Rank FIVE
The rank FIVE (5)


SIX

public static final Rank SIX
The rank SIX (6)


SEVEN

public static final Rank SEVEN
The rank SEVEN (7)


EIGHT

public static final Rank EIGHT
The rank EIGHT (8)


NINE

public static final Rank NINE
The rank NINE (9)


TEN

public static final Rank TEN
The rank TEN (10)


JACK

public static final Rank JACK
The rank JACK


QUEEN

public static final Rank QUEEN
The rank QUEEN


KING

public static final Rank KING
The rank KING

Method Detail

VALUES

public static Rank[] VALUES()
VALUES A static method to return all ranks

Returns:
an array of Rank objects suitable for looping

getSymbol

public java.lang.String getSymbol()
Accessor the Rank's symbol

Returns:
the 1-char symbol as a String

getName

public java.lang.String getName()
Accessor for the Rank's name

Returns:
the rank's name as a String

equals

public boolean equals(Rank otherRank)
Determines if two Rank objects are equal

Parameters:
otherRank - to be compared with
Returns:
true if equal, false if not