Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## glassfrog.handevaluator
Class EvaluateDeck

    java.lang.Object
      glassfrog.handevaluator.EvaluateDeck

    public class EvaluateDeck

extends java.lang.Object

A Deck of 52 Cards which can be dealt and shuffled

Author:
  Aaron Davidson

Field Summary
`private EvaluateCard[]` | `gCards`
`static int` | `NUM_CARDS`
`private char` | `position`
`private java.util.Random` | `r`

Constructor Summary
`EvaluateDeck()` Constructor.
`EvaluateDeck(long seed)` Constructor w/ shuffle seed.

Method Summary
`int` | `cardsLeft()` Obtain the number of cards left in the deck
`EvaluateCard` | `deal()` Obtain the next card in the deck.
`EvaluateCard` | `dealCard()` Obtain the next card in the deck.
`void` | `extractCard(EvaluateCard c)` Remove a card from within the deck.
`void` | `extractHand(EvaluateHand h)` Remove all cards in the given hand from the Deck.
`EvaluateCard` | `extractRandomCard()` Remove and return a randomly selected card from within the deck.
`int` | `findCard(EvaluateCard c)` Find position of Card in Deck.
`private int` | `findDiscard(EvaluateCard c)`
`EvaluateCard` | `getCard(int i)` Obtain the card at a specific index in the deck.
`int` | `getTopCardIndex()` Obtain the position of the top card.
`EvaluateCard` | `pickRandomCard()` Return a randomly selected card from within the deck without removing it.
`private int` | `randInt(int range)`
`void` | `replaceCard(EvaluateCard c)` Place a card back into the deck.
`void` | `reset()` Places all cards back into the deck.
`void` | `shuffle()` Shuffles the cards in the deck.
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### NUM_CARDS

    public static final int NUM_CARDS

See Also:
  Constant Field Values

### gCards

    private EvaluateCard[] gCards

### position

    private char position

### r

    private java.util.Random r

Constructor Detail

### EvaluateDeck

    public EvaluateDeck()

  Constructor.

### EvaluateDeck

    public EvaluateDeck(long seed)

  Constructor w/ shuffle seed.

  Parameters:
    `seed` - the seed to use in randomly shuffling the deck.

Method Detail

### reset

    public void reset()

  Places all cards back into the deck. Note: Does not sort the deck.

### shuffle

    public void shuffle()

  Shuffles the cards in the deck.

### deal

    public EvaluateCard deal()

  Obtain the next card in the deck. If no cards remain, a null card is returned

  Returns:
    the card dealt

### dealCard

    public EvaluateCard dealCard()

  Obtain the next card in the deck. If no cards remain, a null card is returned

  Returns:
    the card dealt

### findCard

    public int findCard(EvaluateCard c)

  Find position of Card in Deck.

### findDiscard

    private int findDiscard(EvaluateCard c)

### extractHand

    public void extractHand(EvaluateHand h)

  Remove all cards in the given hand from the Deck.

### extractCard

    public void extractCard(EvaluateCard c)

  Remove a card from within the deck.

  Parameters:
    `c` - the card to remove.

### extractRandomCard

    public EvaluateCard extractRandomCard()

  Remove and return a randomly selected card from within the deck.

### pickRandomCard

    public EvaluateCard pickRandomCard()

  Return a randomly selected card from within the deck without removing it.

### replaceCard

    public void replaceCard(EvaluateCard c)

  Place a card back into the deck.

  Parameters:
    `c` - the card to insert.

### getTopCardIndex

    public int getTopCardIndex()

  Obtain the position of the top card. (the number of cards dealt from the deck)

  Returns:
    the top card index

### cardsLeft

    public int cardsLeft()

  Obtain the number of cards left in the deck

### getCard

    public EvaluateCard getCard(int i)

  Obtain the card at a specific index in the deck. Does not matter if card has been dealt or not. If i < topCardIndex it has been dealt.

  Parameters:
    `i` - the index into the deck (0..51)
  Returns:
    the card at position i

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### randInt

    private int randInt(int range)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD