com.threerings.parlor.card.data

## Class Deck

- java.lang.Object
- - java.util.AbstractCollection<E>
  - - java.util.AbstractList<E>
    - - java.util.ArrayList<E>
      - - com.threerings.util.StreamableArrayList<Card>
        - - com.threerings.parlor.card.data.Deck

All Implemented Interfaces:
  com.threerings.io.Streamable, CardCodes, com.threerings.presents.data.InvocationCodes, Serializable, Cloneable, Iterable<Card>, Collection<Card>, List<Card>, RandomAccess

    public class Deck
    extends com.threerings.util.StreamableArrayList<Card>
    implements CardCodes

Instances of this class represent decks of cards.

See Also:
  Serialized Form

### Nested Class Summary

### Nested classes/interfaces inherited from interface com.threerings.io.Streamable

`com.threerings.io.Streamable.Closure`

### Field Summary

### Fields inherited from interface com.threerings.parlor.card.data.CardCodes

`ACE, BLACK_JOKER, CLUBS, DIAMONDS, HEARTS, JACK, KING, QUEEN, RED_JOKER, SPADES`

### Fields inherited from interface com.threerings.presents.data.InvocationCodes

`ACCESS_DENIED, E_ACCESS_DENIED, E_INTERNAL_ERROR, GLOBAL_GROUP, INTERNAL_ERROR`

### Constructor Summary

Constructors
Constructor and Description
`Deck()` Default constructor creates an unshuffled deck of cards without jokers.
`Deck(boolean includeJokers)` Constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`Hand` `dealHand(int size)` Deals a hand of cards from the deck.
`void` `reset(boolean includeJokers)` Resets the deck to its initial state: an unshuffled deck of 52 or 54 cards, depending on whether the jokers are included.
`void` `returnHand(Hand hand)` Returns a hand of cards to the deck.
`void` `shuffle()` Shuffles the deck.
`void` `shuffle(Random r)` Shuffles the deck.

### Methods inherited from class com.threerings.util.StreamableArrayList

`newList, readObject, writeObject`

### Methods inherited from class java.util.ArrayList

`add, add, addAll, addAll, clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize`

### Methods inherited from class java.util.AbstractList

`equals, hashCode`

### Methods inherited from class java.util.AbstractCollection

`containsAll, toString`

### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface java.util.List

`containsAll, equals, hashCode`

### Methods inherited from interface java.util.Collection

`parallelStream, stream`

### Constructor Detail

#### Deck

    public Deck()

Default constructor creates an unshuffled deck of cards without jokers.

#### Deck

    public Deck(boolean includeJokers)

Constructor.

Parameters:
  `includeJokers` - whether or not to include the two jokers in the deck

### Method Detail

#### reset

    public void reset(boolean includeJokers)

Resets the deck to its initial state: an unshuffled deck of 52 or 54 cards, depending on whether the jokers are included.

Parameters:
  `includeJokers` - whether or not to include the two jokers in the deck

#### shuffle

    public void shuffle()

Shuffles the deck.

#### shuffle

    public void shuffle(Random r)

Shuffles the deck.

#### dealHand

    public Hand dealHand(int size)

Deals a hand of cards from the deck.

Parameters:
  `size` - the size of the hand to deal
Returns:
  the newly created and populated hand, or null if there are not enough cards in the deck to deal the hand

#### returnHand

    public void returnHand(Hand hand)

Returns a hand of cards to the deck.

Parameters:
  `hand` - the hand of cards to return