Package jadex.bdi.examples.blackjack
Class CardSet
- java.lang.Object
- 
- jadex.bdi.examples.blackjack.CardSet
 
- 
 public class CardSet extends java.lang.ObjectThis class represents a whole blackjack-cardSet. Blackjack-cardSets are usually composed of 6 'normal' cardSets, each containing 52 cards.
- 
- 
Field SummaryFields Modifier and Type Field Description static java.lang.StringACEstatic java.lang.StringCLUBstatic java.lang.StringDIAMONDstatic java.lang.StringHEARTstatic java.lang.StringJACKstatic java.lang.StringKINGstatic intNUMBER_CARDSstatic intNUMBER_PACKSstatic java.lang.StringQUEENstatic java.lang.StringSPADE
 - 
Constructor SummaryConstructors Constructor Description CardSet()Cards have to be encoded as Strings, cause they are being sent as a message's content and only Strings are allowed as the content-objects of ACLMessages (exceptions are Predicates and Actions, but these are ontology-specific objects)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static intcalculateDeckValue(Card[] cards)This method calculates the overall value of a cardSet.CarddrawCard()This method returns a randomly chosen card from the cardSet.java.lang.StringtoString()Create a string representation of the card set.
 
- 
- 
- 
Field Detail- 
NUMBER_PACKSpublic static final int NUMBER_PACKS - See Also:
- Constant Field Values
 
 - 
NUMBER_CARDSpublic static final int NUMBER_CARDS - See Also:
- Constant Field Values
 
 - 
JACKpublic static final java.lang.String JACK - See Also:
- Constant Field Values
 
 - 
QUEENpublic static final java.lang.String QUEEN - See Also:
- Constant Field Values
 
 - 
KINGpublic static final java.lang.String KING - See Also:
- Constant Field Values
 
 - 
ACEpublic static final java.lang.String ACE - See Also:
- Constant Field Values
 
 - 
DIAMONDpublic static final java.lang.String DIAMOND - See Also:
- Constant Field Values
 
 - 
HEARTpublic static final java.lang.String HEART - See Also:
- Constant Field Values
 
 - 
SPADEpublic static final java.lang.String SPADE - See Also:
- Constant Field Values
 
 - 
CLUBpublic static final java.lang.String CLUB - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
drawCardpublic Card drawCard() This method returns a randomly chosen card from the cardSet.- Returns:
- randomly chosen card, encoded as a String-object.
 
 - 
calculateDeckValuepublic static int calculateDeckValue(Card[] cards) This method calculates the overall value of a cardSet. The only thing to be mentioned is, that aces may count as 1 or 11, and that there is no way to influence this. Aces count 11 as long as the overAll deckValue is beneath 21. Only in case the overAll value lies above 21 and there are aces present, one (or more) aces count as a 1.
 - 
toStringpublic java.lang.String toString() Create a string representation of the card set.- Overrides:
- toStringin class- java.lang.Object
- Returns:
- A string representation of the card set.
 
 
- 
 
-