<commit_before>package utask.model.task;

import utask.commons.exceptions.IllegalValueException;

/**
 * Represents the boolean value of the Status attribute in the uTask.
 * Guarantees: immutable; is valid as declared in
 * {@link #isValidBoolean(String)}
 */
// @@author A0138423J
public class Status {
    public static final String MESSAGE_STATUS_CONSTRAINTS = "Task status should be true/false or "
            + "yes/no case insensitive, and it should not be blank";

    /*
     * The first character of the status must not be a whitespace, otherwise " "
     * (a blank string) becomes a valid input.
     */
    public static final String STATUS_VALIDATION_REGEX = "^(YES|yes|Y|y|TRUE|true|T|t|"
            + "NO|no|N|n|FALSE|false|F|f|Complete|Incomplete)$";
    //
    public final Boolean value;

    /**
     * Validates given status.
     *
     * @throws IllegalValueException
     *             if given name string is invalid.
     */
    public Status(String input) throws IllegalValueException {
        assert input != null;
        String trimmedName = input.trim();
        if (!isValidBoolean(trimmedName)) {
            throw new IllegalValueException(MESSAGE_STATUS_CONSTRAINTS);
        }
        this.value = checkValue(input);
    }

    private Boolean checkValue(String strToEvaluate)
            throws IllegalValueException {
        char value = strToEvaluate.toLowerCase().charAt(0);
        switch (value) {
        case 't':
            return true;
        case 'y':
            return true;
        case 'c':
            return true;
        case 'f':
            return false;
        case 'n':
            return false;
        case 'i':
            return false;
        default:
            throw new IllegalValueException(MESSAGE_STATUS_CONSTRAINTS);
        }
    }

    private Status() {
        this.value = false;
    }

    public static Status getEmptyStatus() {
        return new Status();
    }

    public boolean isEmpty() {
        return "".equals(value);
    }

    public boolean isStatusComplete() {
        return value;
    }

    /**
     * Returns true if a given string is a valid true/false or yes/no.
     */
    public static boolean isValidBoolean(String test) {
        return test.matches(STATUS_VALIDATION_REGEX);
    }

    @Override
    public String toString() {
        if (value) {
            return StatusAsString.TRUE.toString();
        } else {
            return StatusAsString.FALSE.toString();
        }
    }

    @Override
    public boolean equals(Object other) {
        return other == this // short circuit if same object
                || (other instanceof Status // instanceof handles nulls
                        && this.value.equals(((Status) other).value)); // state
                                                                       // check
    }

    @Override
    public int hashCode() {
        return value.hashCode();
    }

    public enum StatusAsString {
        TRUE("Complete"), FALSE("Incomplete");

        private final String text;

        private StatusAsString(final String text) {
            this.text = text;
        }

        @Override
        public String toString() {
            return text;
        }
    }
}<commit_msg>Change status toString() to use static string than enum<commit_after>package utask.model.task;

import utask.commons.exceptions.IllegalValueException;

/**
 * Represents the boolean value of the Status attribute in the uTask.
 * Guarantees: immutable; is valid as declared in
 * {@link #isValidBoolean(String)}
 */
// @@author A0138423J
public class Status {
    public static final String MESSAGE_STATUS_CONSTRAINTS = "Task status should be true/false or "
            + "yes/no case insensitive, and it should not be blank";
    public static final String STATUS_COMPLETE = "Complete";
    public static final String STATUS_INCOMPLETE = "Incomplete";

    /*
     * The first character of the status must not be a whitespace, otherwise " "
     * (a blank string) becomes a valid input.
     */
    public static final String STATUS_VALIDATION_REGEX = "^(YES|yes|Y|y|TRUE|true|T|t|"
            + "NO|no|N|n|FALSE|false|F|f|Complete|Incomplete)$";

    public final Boolean value;

    /**
     * Validates given status.
     *
     * @throws IllegalValueException
     *             if given name string is invalid.
     */
    public Status(String input) throws IllegalValueException {
        assert input != null;
        String trimmedName = input.trim();
        if (!isValidBoolean(trimmedName)) {
            throw new IllegalValueException(MESSAGE_STATUS_CONSTRAINTS);
        }
        this.value = checkValue(input);
    }

    private Boolean checkValue(String strToEvaluate)
            throws IllegalValueException {
        char value = strToEvaluate.toLowerCase().charAt(0);
        switch (value) {
        case 't':
            return true;
        case 'y':
            return true;
        case 'c':
            return true;
        case 'f':
            return false;
        case 'n':
            return false;
        case 'i':
            return false;
        default:
            throw new IllegalValueException(MESSAGE_STATUS_CONSTRAINTS);
        }
    }

    private Status() {
        this.value = false;
    }

    public static Status getEmptyStatus() {
        return new Status();
    }

    public boolean isEmpty() {
        return "".equals(value);
    }

    public boolean isStatusComplete() {
        return value;
    }

    /**
     * Returns true if a given string is a valid true/false or yes/no.
     */
    public static boolean isValidBoolean(String test) {
        return test.matches(STATUS_VALIDATION_REGEX);
    }

    @Override
    public String toString() {
        if (value) {
            return STATUS_COMPLETE;
        } else {
            return STATUS_INCOMPLETE;
        }
    }

    @Override
    public boolean equals(Object other) {
        return other == this // short circuit if same object
                || (other instanceof Status // instanceof handles nulls
                        && this.value.equals(((Status) other).value)); // state
                                                                       // check
    }

    @Override
    public int hashCode() {
        return value.hashCode();
    }
}
{'fraction_non_alphanumeric': 0.09128237523689198, 'fraction_numerical': 0.002526847757422615, 'mean_word_length': 1.9292321924144311, '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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1777507', 'n_tokens_mistral': 1680, 'n_tokens_neox': 1633, 'n_words': 495}