|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.vizzini.util.AbstractCollection
org.vizzini.util.AbstractMap
org.vizzini.game.TokenCollection
org.vizzini.game.cardgame.CardCollection
public class CardCollection
Provides a card collection. This collection can be used for a full deck, a discard pile, or an agent's hand.
Constructor Summary | |
---|---|
CardCollection()
|
Method Summary | |
---|---|
ICard |
get(int index)
Return the card at the given index. |
ICard |
get(String name,
ISuit suit)
Return the card with the given name and suit. |
ICard |
getFirst()
Return the first card. |
Collection |
getFlushes(int minimumCount)
Return a collection of CardCollection s of flushes. |
protected Object |
getKey(Object object)
Return the card key. |
protected Object |
getKey(String name,
ISuit suit)
Return the card key. |
Collection |
getKinds(int minimumCount)
Return a collection of CardCollection s of kinds. |
ICard |
getLast()
Return the last card. |
Collection |
getStraights(int minimumCount)
Return a collection of CardCollection s of straights. |
protected Class |
getType()
Return the type this collection holds. |
void |
propertyChange(PropertyChangeEvent event)
Implement a property change listener for relevant token properties. |
ICard |
removeFirst()
Remove and return the first card. |
ICard |
removeLast()
Remove and return the last card. |
void |
shuffle()
Randomly reorder the cards. |
void |
sort()
Sort the cards. |
Methods inherited from class org.vizzini.game.TokenCollection |
---|
add, clone, configure, configure, findByName, get, get, getData, getKey, getTokenPropertyNames, iterator, remove |
Methods inherited from class org.vizzini.util.AbstractMap |
---|
clear, contains, equals, hashCode, isEmpty, iterator, size, toString |
Methods inherited from class org.vizzini.util.AbstractCollection |
---|
addAll, containsAll, removeAll, retainAll, toArray, toArray |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.vizzini.game.ITokenCollection |
---|
clone, configure, findByName, get, get, iterator |
Methods inherited from interface org.vizzini.util.ICollection |
---|
toString |
Methods inherited from interface java.util.Collection |
---|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
Constructor Detail |
---|
public CardCollection()
Method Detail |
---|
public ICard get(int index)
get
in interface ICardCollection
public ICard get(String name, ISuit suit)
public ICard getFirst()
getFirst
in interface ICardCollection
public Collection getFlushes(int minimumCount)
CardCollection
s of flushes. Each
collection will contain at least the given minimum number of cards.
minimumCount
- Minimum number of cards required to be considered a
kind.public Collection getKinds(int minimumCount)
CardCollection
s of kinds. Each
collection will contain at least the given minimum number of cards.
getKinds
in interface ICardCollection
minimumCount
- Minimum number of cards required to be considered a
kind.public ICard getLast()
getLast
in interface ICardCollection
public Collection getStraights(int minimumCount)
CardCollection
s of straights. Each
collection will contain at least the given minimum number of cards.
getStraights
in interface ICardCollection
minimumCount
- Minimum number of cards required to be considered a
kind.public void propertyChange(PropertyChangeEvent event)
propertyChange
in interface PropertyChangeListener
propertyChange
in class TokenCollection
public ICard removeFirst()
removeFirst
in interface ICardCollection
public ICard removeLast()
removeLast
in interface ICardCollection
public void shuffle()
shuffle
in interface ICardCollection
public void sort()
sort
in interface ICardCollection
protected Object getKey(Object object)
getKey
in class TokenCollection
protected Object getKey(String name, ISuit suit)
protected Class getType()
getType
in class TokenCollection
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2007 Vizzini.org. All Rights Reserved. | 2007.12.25.03.00.02 |