package seedu.taskboss.model.category;


import seedu.taskboss.commons.exceptions.IllegalValueException;

/**
 * Represents a Category in TaskBoss.
 * Guarantees: immutable; name is valid as declared in {@link #isValidCategoryName(String)}
 */
public class Category {

    public static final String MESSAGE_CATEGORY_CONSTRAINTS = "Categories names should be alphanumeric";
    public static final String CATEGORY_VALIDATION_REGEX = "\\p{Alnum}+";

    public final String categoryName;

    /**
     * Validates given category name.
     *
     * @throws IllegalValueException if the given category name string is invalid.
     */
    public Category(String name) throws IllegalValueException {
        assert name != null;
        String trimmedName = name.trim();
        if (!isValidCategoryName(trimmedName)) {
            throw new IllegalValueException(MESSAGE_CATEGORY_CONSTRAINTS);
        }
        this.categoryName = trimmedName;
    }

    /**
     * Returns true if a given string is a valid category name.
     */
    public static boolean isValidCategoryName(String test) {
        return test.matches(CATEGORY_VALIDATION_REGEX);
    }

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

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

    /**
     * Format state as text for viewing.
     */
    public String toString() {
        return '[' + categoryName + ']';
    }

}

@@ -922,16 +922,27 @@
 yName = 
+formatName(
 trimmedN
@@ -944,16 +944,17 @@
 mmedName
+)
 ;%0A    %7D%0A
@@ -1675,10 +1675,345 @@
 %0A    %7D%0A%0A
+    //@@author A0147990R   %0A    private String formatName(String name) %7B%0A        if (name.length() %3C= 1) %7B%0A            return name.toUpperCase();%0A        %7D else %7B%0A            String first = name.substring(0, 1).toUpperCase();%0A            String rest = name.substring(1).toLowerCase();%0A            return first + rest;%0A        %7D%0A    %7D%0A%0A
 %7D%0A

add formatName method in Category class