|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectks.common.model.Element
ks.common.model.Stack
ks.common.model.Deck
Models a deck of cards as a Stack
.
Note: Cards are only removed from the top of the deck, but during the initialization routine, this subclass makes detailed use of the actual structure of cards within a stack.
When a Deck is created, it is initially empty. The proper way to create a deck is as follows:
Deck d = new Deck ("personalName");The
d.create (778726);
create
method will randomly shuffle the deck using a deterministic
algorithm using 778726 as the seed for pseudo-random shuffling.
Creation date: (9/30/01 10:42:44 PM)
Constructor Summary | |
Deck()
Construct an empty deck. |
|
Deck(java.lang.String name)
Construct an empty deck with the given name. |
Method Summary | |
void |
create(int seed)
Create a deck using the prespecified shuffling algorithm based upon this seed value. |
void |
shuffle(int seed)
Shuffle the deck using the given seed value as random seed. |
Methods inherited from class ks.common.model.Stack |
add, alternatingColors, alternatingColors, ascending, ascending, count, descending, descending, deselect, empty, get, getNumSelectedCards, getSelected, peek, peek, push, rank, removeAll, sameColor, sameColor, sameRank, sameRank, sameSuit, sameSuit, select, select, suit, toString |
Methods inherited from class ks.common.model.Element |
getListener, getName, setListener, setName |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Deck()
public Deck(java.lang.String name)
If the name parameter passed in is null, then a generated name will be used.
name
- StringMethod Detail |
public void create(int seed)
This method invokes the initialize
method to properly construct the
full deck before the shuffling algorithm commences. Note that this method makes
detailed use of the internal structure of a Stack.
Creation date: (9/30/01 10:44:19 PM)
seed
- intpublic void shuffle(int seed)
seed
-
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |