<commit_before>package hu.unideb.inf.JCardGamesFX.model;

import hu.unideb.inf.JCardGamesFX.view.CardObserver;

import java.util.ArrayList;
import java.util.List;

/**
 * Abstract class representing the concept of a playing card.
 */
public abstract class Card {

  /**
   * The list of views attached to this card.
   */
  List<CardObserver> views = new ArrayList<>();
  /**
   * Whether the card is facing down.
   */
  private boolean faceDown;
  private Suit suit;
  private Rank rank;

  /**
   * Constructs a {@link Card} object, with the specified suit and rank.
   *
   * @param faceDown Whether the card is facing down.
   * @param suit     The suit of the card.
   * @param rank     The rank of the card.
   */
  public Card(boolean faceDown, Suit suit, Rank rank) {
    this.faceDown = faceDown;
    this.suit = suit;
    this.rank = rank;
  }

  /**
   * Constructs a {@link Card} object.
   *
   * @param faceDown Whether the card is facing down.
   */
  public Card(boolean faceDown) {
    this.faceDown = faceDown;
  }

  /**
   * Returns the suit of this card.
   *
   * @return The Suit of this card.
   */
  public Suit getSuit() {
    return suit;
  }

  /**
   * Sets the suit of this card.
   * @param suit The suit to be set.
   */
  public void setSuit(Suit suit) {
    this.suit = suit;
  }

  /**
   * Returns the rank of this card.
   *
   * @return The rank of this card.
   */
  public Rank getRank() {
    return rank;
  }

  /**
   * Sets the rank of this card.
   * @param rank The rank to be set.
   */
  public void setRank(Rank rank) {
    this.rank = rank;
  }

  /**
   * Returns a {@link String} representation of this card.
   *
   * @return The {@link String} representation of this card.
   */
  @Override
  public String toString() {
    return "The " + rank + " of " + suit;
  }

  /**
   * Flips the card.
   */
  public void flip() {
    faceDown = !faceDown;
    updateViews();
  }

  /**
   * Turns the card down.
   */
  public void faceDown() {
    faceDown = true;
    updateViews();
  }

  /**
   * Turns the card up.
   */
  public void faceUp() {
    faceDown = false;
    updateViews();
  }

  /**
   * Returns whether the card is facing down.
   *
   * @return true if the card is facing down, false otherwise.
   */
  public boolean isFaceDown() {
    return faceDown;
  }

  /**
   * Adds a {@link CardObserver} to the list of views.
   *
   * @param view The {@link CardObserver} to be added.
   */
  public void addView(CardObserver view) {
    views.add(view);
    updateViews();
  }

  /**
   * Removes a {@link CardObserver} from the list of views.
   *
   * @param view The {@link CardObserver} to be removed.
   * @return true if successful, false otherwise.
   */
  public boolean removeView(CardObserver view) {
    return views.remove(view);
  }

  /**
   * Returns the list of views attached to this card.
   *
   * @return The list of views.
   */
  public List<CardObserver> getViews() {
    return views;
  }

  /**
   * Updates all views attached to this card.
   */
  private void updateViews() {
    views.forEach(CardObserver::update);
  }

}<commit_msg>Added getId() abstract method<commit_after>package hu.unideb.inf.JCardGamesFX.model;

import hu.unideb.inf.JCardGamesFX.view.CardObserver;

import java.util.ArrayList;
import java.util.List;

/**
 * Abstract class representing the concept of a playing card.
 */
public abstract class Card {

  /**
   * The list of views attached to this card.
   */
  List<CardObserver> views = new ArrayList<>();
  /**
   * Whether the card is facing down.
   */
  private boolean faceDown;
  private Suit suit;
  private Rank rank;

  /**
   * Constructs a {@link Card} object, with the specified suit and rank.
   *
   * @param faceDown Whether the card is facing down.
   * @param suit     The suit of the card.
   * @param rank     The rank of the card.
   */
  public Card(boolean faceDown, Suit suit, Rank rank) {
    this.faceDown = faceDown;
    this.suit = suit;
    this.rank = rank;
  }

  /**
   * Constructs a {@link Card} object.
   *
   * @param faceDown Whether the card is facing down.
   */
  public Card(boolean faceDown) {
    this.faceDown = faceDown;
  }

  /**
   * Returns the suit of this card.
   *
   * @return The Suit of this card.
   */
  public Suit getSuit() {
    return suit;
  }

  /**
   * Sets the suit of this card.
   * @param suit The suit to be set.
   */
  public void setSuit(Suit suit) {
    this.suit = suit;
  }

  /**
   * Returns the rank of this card.
   *
   * @return The rank of this card.
   */
  public Rank getRank() {
    return rank;
  }

  /**
   * Sets the rank of this card.
   * @param rank The rank to be set.
   */
  public void setRank(Rank rank) {
    this.rank = rank;
  }

  /**
   * Returns a {@link String} representation of this card.
   *
   * @return The {@link String} representation of this card.
   */
  @Override
  public String toString() {
    return "The " + rank + " of " + suit;
  }

  /**
   * Flips the card.
   */
  public void flip() {
    faceDown = !faceDown;
    updateViews();
  }

  /**
   * Turns the card down.
   */
  public void faceDown() {
    faceDown = true;
    updateViews();
  }

  /**
   * Turns the card up.
   */
  public void faceUp() {
    faceDown = false;
    updateViews();
  }

  /**
   * Returns whether the card is facing down.
   *
   * @return true if the card is facing down, false otherwise.
   */
  public boolean isFaceDown() {
    return faceDown;
  }

  /**
   * Adds a {@link CardObserver} to the list of views.
   *
   * @param view The {@link CardObserver} to be added.
   */
  public void addView(CardObserver view) {
    views.add(view);
    updateViews();
  }

  /**
   * Removes a {@link CardObserver} from the list of views.
   *
   * @param view The {@link CardObserver} to be removed.
   * @return true if successful, false otherwise.
   */
  public boolean removeView(CardObserver view) {
    return views.remove(view);
  }

  /**
   * Returns the list of views attached to this card.
   *
   * @return The list of views.
   */
  public List<CardObserver> getViews() {
    return views;
  }

  /**
   * Updates all views attached to this card.
   */
  private void updateViews() {
    views.forEach(CardObserver::update);
  }

  public abstract String getId();

}
{'fraction_non_alphanumeric': 0.11653718091009989, 'fraction_numerical': 0.0, 'mean_word_length': 2.3182535507627566, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5008939', 'n_tokens_mistral': 2051, 'n_tokens_neox': 2006, 'n_words': 691}