<commit_before>package nl.jft.logic.participant;

import nl.jft.common.Identifiable;
import nl.jft.common.util.Arguments;
import nl.jft.common.util.Numbers;

import java.time.LocalDateTime;
import java.util.Objects;

/**
 * An {@code Elo} represents the rating of a {@link Participant}. This class provides information about what the rating is, and when it was achieved.
 * It is of the type {@link Identifiable} so that it can be stored in a database.
 *
 * @author Lesley
 */
public class Elo implements Identifiable {

    private final int id;
    private final double rating;
    private final LocalDateTime time;

    /**
     * Initializes a new {@code Elo} using the given arguments.
     *
     * @param id     The {@code id} of this {@code Elo}, used by external parties to identify this {@code Elo}.
     * @param rating The actual {@code Rating} tied to this {@code Elo}, should not be negative.
     * @param time   The {@code Time} at which this {@code Elo}-rating was achieved, should not be {@code null}.
     */
    public Elo(int id, double rating, LocalDateTime time) {
        this.id = id;
        this.rating = Arguments.requireNotNegative(rating);
        this.time = Objects.requireNonNull(time);
    }

    @Override
    public boolean equals(Object other) {
        if (!(other instanceof Elo)) {
            return false;
        }

        Elo o = (Elo) other;
        return o.id == id && Numbers.checkEqual(o.rating, rating) && o.time.equals(time);
    }<commit_msg>Fix documentation and added second constructor to Elo.<commit_after>package nl.jft.logic.participant;

import nl.jft.common.Identifiable;
import nl.jft.common.util.Arguments;
import nl.jft.common.util.Numbers;
import nl.jft.logic.LogicConstants;

import java.time.LocalDateTime;
import java.util.Objects;

/**
 * An {@code Elo} represents the rating of a {@link Participant}. This class provides information about what the rating is, and when it was achieved.
 * It is of the type {@link Identifiable} so that it can be stored in a database.
 *
 * @author Lesley
 */
public class Elo implements Identifiable {

    private final int id;
    private final double rating;
    private final LocalDateTime time;

    /**
     * Initializes a new {@code Elo} by invoking an other constructor ({@link #Elo(int, double, LocalDateTime)}.
     * This constructor only uses a {@code rating}, the {@code id} used is {@link LogicConstants#INTERNAL_ID} and the
     * {@code time} used is {@link LogicConstants#INTERNAL_DATETIME}.
     *
     * @param rating The actual {@code Rating} tied to this {@code Elo}, should not be negative.
     */
    public Elo(double rating) {
        this(LogicConstants.INTERNAL_ID, rating, LogicConstants.INTERNAL_DATETIME);
    }

    /**
     * Initializes a new {@code Elo} using the given arguments.
     *
     * @param id     The {@code id} of this {@code Elo}, used by external parties to identify this {@code Elo}.
     * @param rating The actual {@code Rating} tied to this {@code Elo}, should not be negative.
     * @param time   The {@code Time} at which this {@code Elo}-rating was achieved, should not be {@code null}.
     * @throws NullPointerException     If {@code time} is {@code null}.
     * @throws IllegalArgumentException If {@code rating} is negative.
     */
    public Elo(int id, double rating, LocalDateTime time) {
        this.id = id;
        this.rating = Arguments.requireNotNegative(rating);
        this.time = Objects.requireNonNull(time);
    }

    @Override
    public boolean equals(Object other) {
        if (!(other instanceof Elo)) {
            return false;
        }

        Elo o = (Elo) other;
        return o.id == id && Numbers.checkEqual(o.rating, rating) && o.time.equals(time);
    }
{'fraction_non_alphanumeric': 0.10540324727175938, 'fraction_numerical': 0.0, 'mean_word_length': 3.0192513368983955, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4885012', 'n_tokens_mistral': 1080, 'n_tokens_neox': 1063, 'n_words': 409}