-footer

garrettsmith.playingcards
Class CardList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList
              extended by garrettsmith.playingcards.CardList
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.List, java.util.RandomAccess

public final class CardList
extends java.util.ArrayList

Provides a List with some protection to ensure only Card objects are put into the list.

Since:
Blackjack v1.0
Version:
Blackjack v1.0
Author:
Garrett Smith, gsmith at northwestern dot edu
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
CardList()
          Creates an empty card list with an initial capaciy of 10.
CardList(CardList cards)
          Creates a card list which contains the contents of cards.
CardList(int capacity)
          Creates an empty card list with an initial capaciy of capacity.
 
Method Summary
 boolean add(java.lang.Object o)
          Adds a card to the list.
 Card getCard(int index)
          Returns a Card from the specified index.
 Card removeCard(int i)
          Removes a Card at the specified index.
 
Methods inherited from class java.util.ArrayList
add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

CardList

public CardList()
Creates an empty card list with an initial capaciy of 10.


CardList

public CardList(int capacity)
Creates an empty card list with an initial capaciy of capacity.


CardList

public CardList(CardList cards)
Creates a card list which contains the contents of cards.

Method Detail

add

public boolean add(java.lang.Object o)
Adds a card to the list.

Specified by:
add in interface java.util.Collection
Specified by:
add in interface java.util.List
Overrides:
add in class java.util.ArrayList
Throws:
java.lang.IllegalArgumentException - if o isn't a Card.

getCard

public Card getCard(int index)
Returns a Card from the specified index.


removeCard

public Card removeCard(int i)
Removes a Card at the specified index.


-footer

Copyright 2001-5 Garrett Smith. Use is subject to license terms.