|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectproj3.Rank
public class Rank
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
14 <= Rank's value <= 2 and unique
Rank objects are immutable and unique
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 | |
---|---|
int |
compareTo(Rank r)
Compares two ranks returns negative if the calling object's rank less than the parameter's returns positive if the calling object's rank is greater than the parameter's returns 0 if the ranks are the same |
boolean |
equals(java.lang.Object obj)
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 |
---|
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Rank ACE
public static final Rank TWO
public static final Rank THREE
public static final Rank FOUR
public static final Rank FIVE
public static final Rank SIX
public static final Rank SEVEN
public static final Rank EIGHT
public static final Rank NINE
public static final Rank TEN
public static final Rank JACK
public static final Rank QUEEN
public static final Rank KING
Method Detail |
---|
public static Rank[] VALUES()
public java.lang.String getSymbol()
public java.lang.String getName()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- to be compared with
public int compareTo(Rank r)
compareTo
in interface java.lang.Comparable<Rank>
r
- is the other rank that is compared
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |