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);
    }

    @Override
    public int hashCode() {
        int result = 17;
        result = 31 * result + id;
        result = 31 * result + Double.hashCode(rating);
        result = 31 * result + time.hashCode();
        return result;
    }

    @Override
    public int getId() {
        return id;
    }

    /**
     * Gets the actual {@code Rating} tied to this {@code Elo}.
     *
     * @return A {@code double} representing the actual {@code Rating} tied to this {@code Elo}.
     */
    public double getRating() {
        return rating;
    }

    /**
     * Gets the {@code Time} at which this {@code Elo}-rating was achieved.
     *
     * @return A {@code LocalDateTime} representing the {@code Time} at which this {@code Elo}-rating was achieved.
     */
    public LocalDateTime getTime() {
        return time;
    }

}

@@ -134,16 +134,52 @@
 Numbers;
+%0Aimport nl.jft.logic.LogicConstants;
 %0A%0Aimport
@@ -634,16 +634,560 @@
  time;%0A%0A
+    /**%0A     * Initializes a new %7B@code Elo%7D by invoking an other constructor (%7B@link #Elo(int, double, LocalDateTime)%7D.%0A     * This constructor only uses a %7B@code rating%7D, the %7B@code id%7D used is %7B@link LogicConstants#INTERNAL_ID%7D and the%0A     * %7B@code time%7D used is %7B@link LogicConstants#INTERNAL_DATETIME%7D.%0A     *%0A     * @param rating The actual %7B@code Rating%7D tied to this %7B@code Elo%7D, should not be negative.%0A     */%0A    public Elo(double rating) %7B%0A        this(LogicConstants.INTERNAL_ID, rating, LogicConstants.INTERNAL_DATETIME);%0A    %7D%0A%0A
     /**%0A
@@ -1462,24 +1462,24 @@
 e negative.%0A
-
      * @para
@@ -1579,16 +1579,160 @@
  null%7D.%0A
+     * @throws NullPointerException     If %7B@code time%7D is %7B@code null%7D.%0A     * @throws IllegalArgumentException If %7B@code rating%7D is negative.%0A
      */%0A

Fix documentation and added second constructor to Elo.