<commit_before>package seedu.address.model.task;

import java.time.ZonedDateTime;

public class StartEndDateTime {

    private ZonedDateTime startDateTime;
    private ZonedDateTime endDateTime;

    // TODO add throws IllegalValueException
    public StartEndDateTime(ZonedDateTime startDateTime, ZonedDateTime endDateTime) {
        assert startDateTime != null && endDateTime != null;

        // TODO check if endDateTime > startDateTime, this means endDateTime != startDateTime as well
        this.startDateTime = startDateTime;
        this.endDateTime = endDateTime;
    }

    public ZonedDateTime getStartDateTime() {
        return startDateTime;
    }

    public ZonedDateTime getEndDateTime() {
        return endDateTime;
    }

}
<commit_msg>Add date checks for StartEndDateTime<commit_after>package seedu.address.model.task;

import java.time.ZonedDateTime;
import java.util.Objects;

import seedu.address.model.task.exceptions.InvalidDurationException;
import seedu.address.model.task.exceptions.PastDateTimeException;

//@@author A0140023E
public class StartEndDateTime {
    public static final String MESSAGE_STARTDATETIME_CONSTRAINTS = "Start Date/Time should not be in the past";
    public static final String MESSAGE_ENDDATETIME_CONSTRAINTS = "End Date/Time should not be in the past";
    public static final String MESSAGE_STARTENDDATETIME_CONSTRAINTS = "End Date/Time must be after Start Date/Time";

    private ZonedDateTime startDateTime;
    private ZonedDateTime endDateTime;

    /**
     * Constructs a new StartDateTime with the given start and end time.
     *
     * @param startDateTime the start DateTime
     * @param endDateTime the end DateTime
     * @throws PastDateTimeException if any of the DateTimes are before the current DateTime
     * @throws InvalidDurationException if the end DateTime is before or same as the start DateTime
     */
    public StartEndDateTime(ZonedDateTime startDateTime, ZonedDateTime endDateTime)
            throws PastDateTimeException, InvalidDurationException {
        this(startDateTime, endDateTime, false);
    }

    /**
     * Constructs a new StartEndDateTime with the given start and end time. Ignores checking for
     * dates in the past if {@code ignorePast} is true.
     *
     * @param startDateTime the start DateTime
     * @param endDateTime the end DateTime
     * @param allowPastDateTime ignore checking if DateTimes are in the past. Avoid setting to true except for cases
     *        such as loading from storage
     * @throws PastDateTimeException if any of the DateTimes are before the current DateTime
     * @throws InvalidDurationException if the end DateTime is before or same as the start DateTime
     */
    public StartEndDateTime(ZonedDateTime startDateTime, ZonedDateTime endDateTime, boolean allowPastDateTime)
            throws PastDateTimeException, InvalidDurationException {
        assert startDateTime != null && endDateTime != null;

        if (!allowPastDateTime) {
            // fix the current date time otherwise testing startDateTime might pass but
            // testing endDateTime might fail because the current DateTime might have passed endDateTime
            ZonedDateTime currentDateTime = ZonedDateTime.now();
            if (startDateTime.isBefore(currentDateTime)) {
                throw new PastDateTimeException(MESSAGE_STARTDATETIME_CONSTRAINTS);
            }

            if (endDateTime.isBefore(currentDateTime)) {
                throw new PastDateTimeException(MESSAGE_ENDDATETIME_CONSTRAINTS);
            }
        }

        // The end date time must be after the start date time, but not same or before
        if (!endDateTime.isAfter(startDateTime)) {
            throw new InvalidDurationException(MESSAGE_STARTENDDATETIME_CONSTRAINTS);
        }

        this.startDateTime = startDateTime;
        this.endDateTime = endDateTime;
    }

    public ZonedDateTime getStartDateTime() {
        return startDateTime;
    }

    public ZonedDateTime getEndDateTime() {
        return endDateTime;
    }

    @Override
    public String toString() {
        return "Start Date: " + startDateTime.toString() + " End Date: " + endDateTime.toString();
    }

    @Override
    public boolean equals(Object o) {
        if (o == null) {
            return false;
        }
        if (o == this) {
            return true;
        }
        if (this.getClass() != o.getClass()) {
            return false;
        }
        final StartEndDateTime other = (StartEndDateTime) o;

        return Objects.equals(getStartDateTime(), other.getStartDateTime())
                && Objects.equals(getEndDateTime(), other.getEndDateTime());
    }

    @Override
    public int hashCode() {
        return Objects.hash(startDateTime, endDateTime);
    }

}

{'fraction_non_alphanumeric': 0.0660554282142113, 'fraction_numerical': 0.0014586372160866848, 'mean_word_length': 2.9603960396039604, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '1086121', 'n_tokens_mistral': 1205, 'n_tokens_neox': 1166, 'n_words': 390}