package com.skraylabs.poker.model;

/**
 * Pair of face-down cards held by each player in a game of Texas Hold 'Em poker.
 */
public class Pocket {
  /**
   * First of two pocket cards.
   */
  public Card card1;
  /**
   * Second of two pocket cards.
   */
  public Card card2;

  /**
   * Default constructor.
   */
  public Pocket() {
    this(null, null);
  }

  /**
   * Initializing constructor
   *
   * @param card1 first of two cards
   * @param card2 second of two cards
   */
  public Pocket(Card card1, Card card2) {
    this.card1 = card1;
    this.card2 = card2;
  }

  /**
   * Copy constructor.
   *
   * @param pocket non-null instance from which to copy attributes.
   */
  public Pocket(Pocket pocket) {
    // TODO: implement me!
  }

  /**
   * Helper method to determine if two Card objects are equivalent. Both objects being null is
   * considered equal.
   *
   * @param card1
   * @param card2
   * @return true if the cards are equal (or both are null); false otherwise
   */
  static boolean cardsAreEqual(Card card1, Card card2) {
    boolean result = false;
    if (card1 == null && card2 == null) {
      result = true;
    } else if (card1 != null && card2 != null) {
      result = card1.equals(card2);
    }
    return result;
  }

  @Override
  public boolean equals(Object o) {
    boolean result = false;
    if (o instanceof Pocket) {
      Pocket thatPocket = (Pocket) o;
      boolean card1Equals = cardsAreEqual(this.card1, thatPocket.card1);
      boolean card2Equals = cardsAreEqual(this.card2, thatPocket.card2);
      result = card1Equals && card2Equals;
    }
    return result;
  }
} // end of class Pocket
@@ -727,27 +727,278 @@
  // 
-TODO: implement me!
+Assign card1%0A    if (pocket.card1 == null) %7B%0A      this.card1 = null;%0A    %7D else %7B%0A      this.card1 = new Card(pocket.card1);%0A    %7D%0A    // Assign card2%0A    if (pocket.card2 == null) %7B%0A      this.card2 = null;%0A    %7D else %7B%0A      this.card2 = new Card(pocket.card2);%0A    %7D
 %0A  %7D

Implement Pocket copy constructor.