org.flashcards
Class CardDeck

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.Vector
                    |
                    +--org.flashcards.CardDeck

public class CardDeck
extends java.util.Vector

The CardDeck class represents a deck of flash cards. It is implemented as a Vector. Flash card decks can be loaded from text files that look like this:

 # Comment
 front 1 | back 1
 # Another comment
 front 2 | back 2
 front 3 | back 3
 ...
 

See Also:
Serialized Form

Field Summary
private  java.io.File deckFile
           
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData, serialVersionUID
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
CardDeck()
          Construct an empty card deck.
 
Method Summary
 void flipAll()
          Flip all cards in the deck.
 Card getCard(int index)
          Return the card at the given index.
 java.io.File getFile()
          Get the deck file.
 void load(java.io.File theFile)
          Load a flash card deck from a file with the given name.
 void shuffle()
          Shuffle the deck.
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, ensureCapacityHelper, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
, finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

deckFile

private java.io.File deckFile
Constructor Detail

CardDeck

public CardDeck()
Construct an empty card deck.
Method Detail

getFile

public java.io.File getFile()
Get the deck file.

getCard

public Card getCard(int index)
Return the card at the given index.

load

public void load(java.io.File theFile)
          throws java.io.IOException
Load a flash card deck from a file with the given name.

shuffle

public void shuffle()
Shuffle the deck.

flipAll

public void flipAll()
Flip all cards in the deck.