Class GradeMapping

    • Constructor Detail

      • GradeMapping

        public GradeMapping()
      • GradeMapping

        public GradeMapping​(GradingScale gradingScale)
    • Method Detail

      • getName

        public String getName()
      • setDefaultValues

        public void setDefaultValues()
        Sets the percentage values for this GradeMapping to their default values.
      • getDefaultBottomPercents

        public Map<String,​Double> getDefaultBottomPercents()
        Backwards-compatible wrapper to get to grading scale.
      • getGrades

        public Collection<String> getGrades()
        Returns:
        An (ordered) collection of the available grade values
      • getDefaultValues

        @Deprecated
        public List<Double> getDefaultValues()
        Deprecated.
        Returns:
        A List of the default grade values. Only used for backward compatibility to pre-grading-scale mappings.
      • getValue

        public Double getValue​(String grade)
        Gets the percentage mapped to a particular grade.
      • getMappedGrade

        public String getMappedGrade​(Double value)
        Get the mapped grade based on the persistent grade mappings
      • getMappedGrade

        public static String getMappedGrade​(Map<String,​Double> gradeMap,
                                            Double value)
        Get the mapped grade based on the passed in grade mappings. NOTE: The gradeMap MUST be sorted!
      • sortGradeMapping

        public static Map<String,​Double> sortGradeMapping​(Map<String,​Double> gradeMap)
        Handles the sorting of the grade mapping.
        Parameters:
        gradeMap -
        Returns:
      • getId

        public Long getId()
      • setId

        public void setId​(Long id)
      • getVersion

        public int getVersion()
      • setVersion

        public void setVersion​(int version)
      • setGradeMap

        public void setGradeMap​(Map<String,​Double> gradeMap)
      • getGradebook

        public Gradebook getGradebook()
      • setGradebook

        public void setGradebook​(Gradebook gradebook)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • standardizeInputGrade

        public String standardizeInputGrade​(String inputGrade)
        Enable any-case input of grades (typically lowercase input for uppercase grades). Look for a case-insensitive match to the input text and if it's found, return the official version.
        Returns:
        The normalized version of the grade, or null if not found.
      • getGradingScale

        public GradingScale getGradingScale()
        Returns:
        the GradingScale used to define this mapping, or null if this is an old Gradebook which uses hard-coded scales
      • setGradingScale

        public void setGradingScale​(GradingScale gradingScale)