Class CardSet


  • public class CardSet
    extends java.lang.Object
    This class represents a whole blackjack-cardSet. Blackjack-cardSets are usually composed of 6 'normal' cardSets, each containing 52 cards.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ACE  
      static java.lang.String CLUB  
      static java.lang.String DIAMOND  
      static java.lang.String HEART  
      static java.lang.String JACK  
      static java.lang.String KING  
      static int NUMBER_CARDS  
      static int NUMBER_PACKS  
      static java.lang.String QUEEN  
      static java.lang.String SPADE  
    • Constructor Summary

      Constructors 
      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 Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static int calculateDeckValue​(Card[] cards)
      This method calculates the overall value of a cardSet.
      Card drawCard()
      This method returns a randomly chosen card from the cardSet.
      java.lang.String toString()
      Create a string representation of the card set.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • CardSet

        public 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 Detail

      • drawCard

        public Card drawCard()
        This method returns a randomly chosen card from the cardSet.
        Returns:
        randomly chosen card, encoded as a String-object.
      • calculateDeckValue

        public 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.
      • toString

        public java.lang.String toString()
        Create a string representation of the card set.
        Overrides:
        toString in class java.lang.Object
        Returns:
        A string representation of the card set.