Card
Date: 2017-05-13

game_backend

## Class Card

- java.lang.Object
- - game_backend.Card

- All Implemented Interfaces:
    java.lang.Comparable<Card>

      public class Card
      extends java.lang.Object
      implements java.lang.Comparable<Card>

  Represents a regular deck card. It contains its suit, its rank and also, for constructor purposes, it declares all suits and ranks that such a card might have.
  Author:
    João Vieira, Guilherme Reis, Catarina Santos

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Card.Ranks`
    `static class` | `Card.Suits`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private Card.Ranks` | `rank`
    `private Card.Suits` | `suit`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Card(Card.Ranks rank, Card.Suits suit)` Constructor of Card.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareTo(Card card)` Provides a comparable method for type card.
    `boolean` | `equals(java.lang.Object obj)`
    `Card.Ranks` | `getRank()` Returns the rank of the present card
    `Card.Suits` | `getSuit()` Returns the suit of the present card
    `int` | `hashCode()`
    `boolean` | `isHighCard()` Evaluates whether the card being evaluated is an high card
    `int` | `minus(Card card)` Provides the true comparable between ranks.
    `java.lang.String` | `toString()` Computes a valid representation of a card that can be printed.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### suit

          private Card.Suits suit

    - #### rank

          private Card.Ranks rank

  - ### Constructor Detail

    - #### Card

          public Card(Card.Ranks rank,
                      Card.Suits suit)

      Constructor of Card. It receives as argument two enumerated types that are declared in the same class and made public to restrict the options for valid ranks and suits
      Parameters:
        `rank` - Rank of card to be created
        `suit` - Suit of card to be created

  - ### Method Detail

    - #### toString

          public java.lang.String toString()

      Computes a valid representation of a card that can be printed.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        String that uniquely identifies a given card

    - #### compareTo

          public int compareTo(Card card)

      Provides a comparable method for type card. The comparison of two cards is bases only in their rank, however, when the rank to be compared is ace, it is considered as an high card, which means that the difference between it and any other card will be the difference between that card and a king plus one.
      Specified by:
        `compareTo` in interface `java.lang.Comparable<Card>`
      Parameters:
        `card` - Card to be compared with the present one
      Returns:
        int distance between the two cards compared

    - #### minus

          public int minus(Card card)

      Provides the true comparable between ranks. This is the one method that should be used for sort the cards.
      Parameters:
        `card` - Card to be compared with the present one
      Returns:
        int numerical distance between the two cards compared

    - #### getSuit

          public Card.Suits getSuit()

      Returns the suit of the present card
      Returns:
        Suits suit of the card being evaluated

    - #### getRank

          public Card.Ranks getRank()

      Returns the rank of the present card
      Returns:
        Ranks rank of the card being evaluated

    - #### isHighCard

          public boolean isHighCard()

      Evaluates whether the card being evaluated is an high card
      Returns:
        boolean true if the card is an high card and false otherwise

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### equals

          public boolean equals(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`