proj2
Class Suit

java.lang.Object
  extended by proj2.Suit

public class Suit
extends java.lang.Object

The Suit class defines each of the 4 suits of a standard deck of playing cards. Using this class assures that all code refers to the suits in the same manner i.e Suit.CLUBS, Suit.DIAMONDS, Suit.HEARTS, and Suit.SPADES with no possibility of conflicting representations

Class Invariant:
The Suit's symbol is a single alphabetic character
The Suit's name is a non-empty string
Suit objects are immutable and unique

Author:
Dennis Frey

Field Summary
static Suit CLUBS
          The suit CLUBS
static Suit DIAMONDS
          The suit DIAMONDS
static Suit HEARTS
          The suit HEARTS
static Suit SPADES
          The suit SPADES
 
Method Summary
 boolean equals(Suit otherSuit)
          Determines if two Suits are the same
 java.lang.String getName()
          Accessor for the long name of the Suit
 java.lang.String getSymbol()
          Accessor for the suit symbol
static Suit[] VALUES()
          VALUES A method to return all suits
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLUBS

public static final Suit CLUBS
The suit CLUBS


DIAMONDS

public static final Suit DIAMONDS
The suit DIAMONDS


HEARTS

public static final Suit HEARTS
The suit HEARTS


SPADES

public static final Suit SPADES
The suit SPADES

Method Detail

VALUES

public static Suit[] VALUES()
VALUES A method to return all suits

Returns:
an array of Suit objects useful for looping

getSymbol

public java.lang.String getSymbol()
Accessor for the suit symbol

Returns:
the 1-char symbol for the suit as a String

getName

public java.lang.String getName()
Accessor for the long name of the Suit

Returns:
the long name of the suit as a String

equals

public boolean equals(Suit otherSuit)
Determines if two Suits are the same

Parameters:
otherSuit - - the suit to compare for equality
Returns:
true if the Suits are equal, false if not