@@ -0,0 +1,2022 @@
+package seedu.taskmanager.model.task;%0A%0Aimport seedu.taskmanager.commons.exceptions.IllegalValueException;%0A%0A/**%0A * Represents a Task's repeat pattern in the task manager. Guarantees:%0A * immutable; is valid as declared in %7B@link #isValidRepeat(String)%7D%0A */%0Apublic class Repeat %7B%0A%0A    public static final String MESSAGE_REPEAT_CONSTRAINTS = %22Repeat patterns should be either %22%0A            + %22DAY, WEEK, MONTH or YEAR%22;%0A%0A    public enum RepeatPattern %7B%0A        DAY, WEEK, MONTH, YEAR%0A    %7D%0A    %0A    public final RepeatPattern pattern;%0A%0A    /**%0A     * Validates given repeat pattern.%0A     *%0A     * @throws IllegalValueException%0A     *             if given repeat pattern string is invalid.%0A     */%0A    public Repeat(String repeat) throws IllegalValueException %7B%0A        assert repeat != null;%0A        String trimmedAndUpperCaseRepeat = repeat.trim().toUpperCase();%0A        this.pattern = toEnum(trimmedAndUpperCaseRepeat);%0A    %7D%0A    %0A    /**%0A     * Returns RepeatPattern enum if a given string is a valid repeat pattern.%0A     */%0A    private RepeatPattern toEnum(String trimmedRepeat) throws IllegalValueException %7B%0A        switch (trimmedRepeat) %7B%0A        case %22DAY%22:%0A            return RepeatPattern.DAY;%0A        case %22WEEK%22:%0A            return RepeatPattern.WEEK;%0A        case %22MONTH%22:%0A            return RepeatPattern.MONTH;%0A        case %22YEAR%22:%0A            return RepeatPattern.YEAR;%0A        default:%0A            throw new IllegalValueException(MESSAGE_REPEAT_CONSTRAINTS);%0A        %7D%0A    %7D%0A%0A    @Override%0A    public String toString() %7B%0A        return pattern.toString();%0A    %7D%0A%0A    @Override%0A    public boolean equals(Object other) %7B%0A        return other == this // short circuit if same object%0A                %7C%7C (other instanceof Repeat // instanceof handles nulls%0A                        && this.pattern.equals(((Repeat) other).pattern)); // state%0A                                                                      // check%0A    %7D%0A%0A    @Override%0A    public int hashCode() %7B%0A        return pattern.hashCode();%0A    %7D%0A%0A%7D%0A

add repeat in task