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


import seedu.emeraldo.commons.exceptions.IllegalValueException;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.util.regex.Matcher;

/**
 * Represents a Task's date and time in Emeraldo.
 * Guarantees: immutable; is valid as declared in {@link #isValidDateTime(String)}
 */
public class DateTime {
    
	//@@author A0139749L
    private static final String MESSAGE_KEYWORD_FROM_CONSTRAINTS = "Invalid format! It should be "
            + "'from DD/MM/YYYY HH:MM to DD/MM/YYYY HH:MM'";

    private static final String MESSAGE_KEYWORD_BY_CONSTRAINTS = "Invalid format! It should be "
            + "'by DD/MM/YYYY HH:MM'";

    private static final String MESSAGE_KEYWORD_ON_CONSTRAINTS = "Invalid format! It should be "
            + "'on DD/MM/YYYY'";

    public static final String MESSAGE_DATETIME_CONSTRAINTS = "Date must follow this format DD/MM/YYYY "
            + "and time must follow this format HH:MM in 24 hours format";
    
    public final String value;
    public final String context;
    public final String overdueContext;
    public final String eventContext;
    public final String valueFormatted;
    public final LocalDate valueDate;
    public final LocalTime valueTime;
    public final LocalDate valueDateEnd;
    public final LocalTime valueTimeEnd;

    /**
     * Validates given date and time.
     *
     * @throws IllegalValueException if given date and time string is invalid.
     */
    public DateTime(String dateTime) throws IllegalValueException {
        assert dateTime != null;
        final Matcher matcher = DateTimeParser.DATETIME_VALIDATION_REGEX.matcher(dateTime);
        
        if (!dateTime.isEmpty() && !matcher.matches()) {
            throw new IllegalValueException(MESSAGE_DATETIME_CONSTRAINTS);
        }
        
        if(dateTime.isEmpty()){
            this.valueDate = null;
            this.valueTime = null;
            this.valueDateEnd = null;
            this.valueTimeEnd = null;<commit_msg>Update Error messages for all keywords to be more relevant<commit_after>package seedu.emeraldo.model.task;


import seedu.emeraldo.commons.exceptions.IllegalValueException;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.util.regex.Matcher;

/**
 * Represents a Task's date and time in Emeraldo.
 * Guarantees: immutable; is valid as declared in {@link #isValidDateTime(String)}
 */
public class DateTime {
    
	//@@author A0139749L
    private static final String MESSAGE_KEYWORD_FROM_CONSTRAINTS = "Invalid format! It should be "
            + "'from DD/MM/YYYY, HH:MM to DD/MM/YYYY, HH:MM'\n"
            + "Accepted date formats:  4/03/2016  |  4/03/16  |  4-03-16  |  4 March 16  |  4/03  |  4 Mar\n"
            + "Accepted time formats:  14:20  (time in 24 hours format)\n"
    		+ "Type 'help' to see the full list of accepted formats in the user guide";

    private static final String MESSAGE_KEYWORD_BY_CONSTRAINTS = "Invalid format! It should be "
            + "'by DD/MM/YYYY, HH:MM'\n"
            + "Accepted date formats:  4/03/2016  |  4/03/16  |  4-03-16  |  4 March 16  |  4/03  |  4 Mar\n"
            + "Accepted time formats:  14:20  (time in 24 hours format)\n"
    		+ "Type 'help' to see the full list of accepted formats in the user guide";

    private static final String MESSAGE_KEYWORD_ON_CONSTRAINTS = "Invalid format! It should be "
            + "'on DD/MM/YYYY'\n"
            + "Accepted date formats:  4/03/2016  |  4/03/16  |  4-03-16  |  4 March 16  |  4/03  |  4 Mar\n"
            + "Type 'help' to see the full list of accepted formats in the user guide";

    public static final String MESSAGE_DATETIME_CONSTRAINTS = "Command format is invalid! "
    		+ "It must be one of the following:\n"
            + "Keyword 'on' : on DD/MM/YYYY\n"
            + "Keyword 'by' : by DD/MM/YYYY, HH:MM\n"
            + "Keyword 'from' and 'to' : from DD/MM/YYYY, HH:MM to DD/MM/YYYY, HH:MM";

    public final String value;
    public final String context;
    public final String overdueContext;
    public final String eventContext;
    public final String valueFormatted;
    public final LocalDate valueDate;
    public final LocalTime valueTime;
    public final LocalDate valueDateEnd;
    public final LocalTime valueTimeEnd;

    /**
     * Validates given date and time.
     *
     * @throws IllegalValueException if given date and time string is invalid.
     */
    public DateTime(String dateTime) throws IllegalValueException {
        assert dateTime != null;
        final Matcher matcher = DateTimeParser.DATETIME_VALIDATION_REGEX.matcher(dateTime);
        
        if (!dateTime.isEmpty() && !matcher.matches()) {
            throw new IllegalValueException(MESSAGE_DATETIME_CONSTRAINTS);
        }
        
        if(dateTime.isEmpty()){
            this.valueDate = null;
            this.valueTime = null;
            this.valueDateEnd = null;
            this.valueTimeEnd = null;
{'fraction_non_alphanumeric': 0.09047237790232186, 'fraction_numerical': 0.020016012810248198, 'mean_word_length': 2.671565025716385, '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': '368402', 'n_tokens_mistral': 1597, 'n_tokens_neox': 1497, 'n_words': 463}