2-APL UPC project.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 52 lines 941 B view raw
1package cardtable; 2 3import javax.swing.ImageIcon; 4 5public class Card { 6 7 private Suit suitValue; 8 private Rank rankValue; 9 private ImageIcon cardImage; 10 11 public Card( Suit suit, Rank rank, ImageIcon cardFace ) { 12 cardImage = cardFace; 13 suitValue = suit; 14 rankValue = rank; 15 } 16 17 18 public static String getFilename( Suit suit, Rank rank ) { 19 return rank.getSymbol() + suit.getSymbol() + ".gif"; 20 } 21 22 23 public Suit getSuit() { 24 return suitValue; 25 } 26 27 public Rank getRank() { 28 return rankValue; 29 } 30 31 32 public ImageIcon getCardImage() { 33 return cardImage; 34 } 35 36 37 public int compareTo( Card AnotherCard ) { 38 Card otherCard = AnotherCard; 39 int suitDiff = suitValue.compareTo( otherCard.suitValue ); 40 int rankDiff = rankValue.compareTo( otherCard.rankValue ); 41 42 43 if ( rankDiff != 0 ) 44 return rankDiff; 45 else 46 return suitDiff; 47 48 } 49 50 51 52}