package tars.model.task;

import tars.commons.exceptions.IllegalValueException;

/**
 * Represents a Task's priority in tars.
 */
public class Priority {
    public static final String MESSAGE_PRIORITY_CONSTRAINTS = "Task priority should be h / m / l";
    public static final String PRIORITY_VALIDATION_REGEX = "[\\p{Lower} ]+";
    
    private String priorityLevel;
    
    /**
     * Validates given task priority level.
     *
     * @throws IllegalValueException if given priority level string is invalid.
     */
    public Priority(String priorityLevel) throws IllegalValueException {
        assert priorityLevel != null;
        priorityLevel = priorityLevel.trim();
        if (!isValidPriorityLevel(priorityLevel)) {
            throw new IllegalValueException(MESSAGE_PRIORITY_CONSTRAINTS);
        }
        this.priorityLevel = priorityLevel;
    }
    
    /**
     * Returns true if a given string is a valid task priority level.
     */
    public static boolean isValidPriorityLevel(String level) {
        return level.matches(PRIORITY_VALIDATION_REGEX);
    }

    public String getLevel() {
        return priorityLevel;
    }

    public void setLevel(String priorityLevel) {
        this.priorityLevel = priorityLevel;
    }
    
}

@@ -323,20 +323,332 @@
 r%7D %5D+%22;%0A
+%0A
     
+public static final String PRIORITY_HIGH = %22high%22;%0A    public static final String PRIORITY_MEDIUM = %22medium%22;%0A    public static final String PRIORITY_LOW = %22low%22;%0A%0A    public static final String PRIORITY_H = %22h%22;%0A    public static final String PRIORITY_M = %22m%22;%0A    public static final String PRIORITY_L = %22l%22;%0A
 %0A    pri
@@ -674,21 +674,17 @@
 yLevel;%0A
-    
 %0A
+
     /**%0A
@@ -770,16 +770,35 @@
 xception
+%0A     *            
  if give
@@ -1185,21 +1185,17 @@
 ;%0A    %7D%0A
-    
 %0A
+
     /**%0A
@@ -1391,32 +1391,46 @@
 _REGEX);%0A    %7D%0A%0A
+    @Override%0A
     public Strin
@@ -1435,16 +1435,16 @@
 ing 
-getLevel
+toString
 () %7B
@@ -1456,24 +1456,326 @@
     
-return priorityL
+String level = %22%22;%0A%0A        switch (priorityLevel) %7B%0A        case PRIORITY_H:%0A            level = PRIORITY_HIGH;%0A            break;%0A        case PRIORITY_M:%0A            level = PRIORITY_MEDIUM;%0A            break;%0A        case PRIORITY_L:%0A            level = PRIORITY_LOW;%0A            break;%0A        %7D%0A%0A        return l
 evel
@@ -1882,15 +1882,11 @@
 ;%0A    %7D%0A
-    
 %0A%7D%0A

Add toString method