program4
Class GoFishCard

java.lang.Object
  extended by program4.Card
      extended by program4.GoFishCard
All Implemented Interfaces:
java.lang.Comparable<GoFishCard>

public class GoFishCard
extends Card
implements java.lang.Comparable<GoFishCard>

Title: The GoFishCard Class

Description: Defines the properties and behaviors of a GoFishcard.

Copyright: Copyright (c) 2010

Author:
F. Graham

Constructor Summary
GoFishCard()
          Default Constructor
GoFishCard(int n)
          Constructor
GoFishCard(int r, int s)
          Constructor
 
Method Summary
 int compareTo(GoFishCard otherCard)
           
static int convertToRank(java.lang.String str)
          A static method that converts a string to a card's equivalent rank
 boolean equals(GoFishCard otherCard)
           
 boolean equals(java.lang.Object otherCard)
           
 
Methods inherited from class program4.Card
compareByRank, compareBySuit, equals, getRank, getRankAsString, getSuit, getSuitAsString, setRank, setSuit, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GoFishCard

public GoFishCard()
Default Constructor


GoFishCard

public GoFishCard(int n)
Constructor

Parameters:
n - a number between 0 and 51 inclusive

GoFishCard

public GoFishCard(int r,
                  int s)
Constructor

Parameters:
r - - a rank (0 to 12) representing the Card's rank
s - - a suit (0 to 3) representing the Card's suit
Method Detail

compareTo

public int compareTo(GoFishCard otherCard)
Specified by:
compareTo in interface java.lang.Comparable<GoFishCard>
Parameters:
otherCard - - a GoFishCard
Returns:
-1 if this card's rank is lower than than other's,
0 if they are the same,
1 if this card's rank is higher than the other's

equals

public boolean equals(GoFishCard otherCard)
Parameters:
otherCard - - a GoFishCard
Returns:
Returns true if this card's rank is the same as otherCard's,
false otherwise

equals

public boolean equals(java.lang.Object otherCard)
Overrides:
equals in class java.lang.Object
Parameters:
otherCard - an Object
Returns:
Returns true if this card's rank is the same as otherCard's,
false otherwise

convertToRank

public static int convertToRank(java.lang.String str)
A static method that converts a string to a card's equivalent rank

Parameters:
str - - "2", "3", "4", "5", "6", "7", "8", "9", "10", "J","Q", "K", "A"
Returns:
the equivalent rank (0 - 12)