package de.unibremen.opensores.model;

/**
 * Enumeration of different Pabo Grades.
 */
public enum PaboGrade {
    GRADE_1_0(1.0,"1,0"),
    GRADE_1_3(1.3,"1,3"),
    GRADE_1_7(1.7,"1,7"),
    GRADE_2_0(2.0,"2,0"),
    GRADE_2_3(2.3,"2,3"),
    GRADE_2_7(2.7,"2,7"),
    GRADE_3_0(3.0,"3,0"),
    GRADE_3_3(3.0,"3,3"),
    GRADE_3_7(3.0,"3,7"),
    GRADE_4_0(4.0,"4,0"),
    GRADE_5_0(5.0,"5,0"),
    /*
    Todo: Hatte PABO da nicht eigene Werte statt 5.0?
     */
    GRADE_CHEATED(5.0,"Täuschung"),
    GRADE_NEGLECTED(5.0,"Versäumnis");

    private final double gradeValue;
    private final String gradeName;

    PaboGrade(final double gradeValue, final String gradeName) {
        this.gradeValue = gradeValue;
        this.gradeName = gradeName;
    }


    @Override
    public String toString() {
        return gradeName;
    }

    public double getGradeValue() {
        return gradeValue;
    }

    public String getGradeName() {
        return gradeName;
    }

    /**
     * Searches for an enum entry by the value of the pabo grade.
     * @param value Value to search for
     * @return Enum entry
     */
    public static PaboGrade valueOf(double value) {
        for (PaboGrade p : PaboGrade.values()) {
            if (p.getGradeValue() == value) {
                return p;
            }
        }

        throw new IllegalArgumentException();
    }

    /**
     * Searches for an enum entry by the name of the pabo grade.
     * @param name Name to search for
     * @return Enum entry
     */
    public static PaboGrade valueOfName(String name) {
        for (PaboGrade p : PaboGrade.values()) {
            if (p.getGradeName().equals(name)) {
                return p;
            }
        }

        throw new IllegalArgumentException();
    }
}

@@ -123,16 +123,18 @@
 1_0(1.0,
+7,
 %221,0%22),%0A
@@ -151,16 +151,18 @@
 1_3(1.3,
+7,
 %221,3%22),%0A
@@ -179,16 +179,18 @@
 1_7(1.7,
+7,
 %221,7%22),%0A
@@ -207,16 +207,18 @@
 2_0(2.0,
+7,
 %222,0%22),%0A
@@ -235,16 +235,18 @@
 2_3(2.3,
+7,
 %222,3%22),%0A
@@ -263,16 +263,18 @@
 2_7(2.7,
+7,
 %222,7%22),%0A
@@ -291,16 +291,18 @@
 3_0(3.0,
+7,
 %223,0%22),%0A
@@ -319,16 +319,18 @@
 3_3(3.0,
+7,
 %223,3%22),%0A
@@ -347,16 +347,18 @@
 3_7(3.0,
+7,
 %223,7%22),%0A
@@ -375,16 +375,18 @@
 4_0(4.0,
+7,
 %224,0%22),%0A
@@ -407,16 +407,18 @@
 5.0,
+8,
 %225,0%22),%0A
     
@@ -417,77 +417,8 @@
 %22),%0A
-    /*%0A    Todo: Hatte PABO da nicht eigene Werte statt 5.0?%0A     */%0A
     
@@ -431,19 +431,22 @@
 CHEATED(
-5.0
+null,3
 ,%22T%C3%A4usch
@@ -472,19 +472,22 @@
 GLECTED(
-5.0
+null,2
 ,%22Vers%C3%A4u
@@ -509,25 +509,25 @@
 ivate final 
-d
+D
 ouble gradeV
@@ -567,16 +567,51 @@
 adeName;
+%0A    private final int gradeRemark;
 %0A%0A    Pa
@@ -624,17 +624,17 @@
 e(final 
-d
+D
 ouble gr
@@ -642,16 +642,53 @@
 deValue,
+ final int gradeRemark,%0A             
  final S
@@ -740,24 +740,64 @@
 gradeValue;%0A
+        this.gradeRemark = gradeRemark;%0A
         this
@@ -1036,32 +1036,101 @@
 adeName;%0A    %7D%0A%0A
+    public int getGradeRemark() %7B%0A        return gradeRemark;%0A    %7D%0A%0A
     /**%0A     * S

Remove grade from PaboGrade for cheated and neglected, add remarks attribute for pabo csv