org.sakaiproject.tool.gradebook
Class CourseGrade

java.lang.Object
  extended byorg.sakaiproject.tool.gradebook.GradableObject
      extended byorg.sakaiproject.tool.gradebook.CourseGrade
All Implemented Interfaces:
Serializable

public class CourseGrade
extends GradableObject

A CourseGrade is a GradableObject that represents the overall course grade in a gradebook.

Author:
Josh Holtzman
See Also:
Serialized Form

Field Summary
static String COURSE_GRADE_NAME
           
static String SORT_BY_CALCULATED_GRADE
           
static String SORT_BY_OVERRIDE_GRADE
           
static String SORT_BY_POINTS_EARNED
           
 
Fields inherited from class org.sakaiproject.tool.gradebook.GradableObject
gradebook, id, mean, name, removed, version
 
Constructor Summary
CourseGrade()
           
 
Method Summary
protected  Double calculateMean(Collection grades, int numEnrollments)
          Calculate the mean for all enrollments, counting null grades as zero.
 void calculateTotalPointsPossible(Collection assignments)
          Calculates the total points possible based on a collection of assignments Note: This calculation assumes that the collection of assignments passed is an accurate collection of the assignments in this course grade's gradebook.
 Date getDateForDisplay()
          A CourseGrade is never "due", so it will always return null.
 Double getPointsForDisplay()
          The course grade can not return the total number of points possible until this value is set explicitly.
 Double getTotalPoints()
           
 boolean isCourseGrade()
           
 void setTotalPoints(Double totalPoints)
           
 
Methods inherited from class org.sakaiproject.tool.gradebook.GradableObject
calculateStatistics, equals, getFormattedMean, getGradebook, getId, getMean, getName, getVersion, hashCode, isRemoved, setGradebook, setId, setMean, setName, setRemoved, setVersion, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

COURSE_GRADE_NAME

public static final String COURSE_GRADE_NAME
See Also:
Constant Field Values

SORT_BY_OVERRIDE_GRADE

public static String SORT_BY_OVERRIDE_GRADE

SORT_BY_CALCULATED_GRADE

public static String SORT_BY_CALCULATED_GRADE

SORT_BY_POINTS_EARNED

public static String SORT_BY_POINTS_EARNED
Constructor Detail

CourseGrade

public CourseGrade()
Method Detail

isCourseGrade

public boolean isCourseGrade()
Specified by:
isCourseGrade in class GradableObject
Returns:
Whether this gradable object is a course grade
See Also:
GradableObject.isCourseGrade()

getPointsForDisplay

public Double getPointsForDisplay()
The course grade can not return the total number of points possible until this value is set explicitly. This should be done while gathering all of the assignments from the database and calling calculateTotalPoints(Collection assignments). TODO Try to figure out a better approach

Specified by:
getPointsForDisplay in class GradableObject
See Also:
GradableObject.getPointsForDisplay()

getDateForDisplay

public Date getDateForDisplay()
A CourseGrade is never "due", so it will always return null.

Specified by:
getDateForDisplay in class GradableObject
See Also:
GradableObject.getDateForDisplay()

calculateTotalPointsPossible

public void calculateTotalPointsPossible(Collection assignments)
Calculates the total points possible based on a collection of assignments Note: This calculation assumes that the collection of assignments passed is an accurate collection of the assignments in this course grade's gradebook.

Parameters:
assignments - The assignments in this gradebook

getTotalPoints

public Double getTotalPoints()
Returns:
Returns the totalPoints.

setTotalPoints

public void setTotalPoints(Double totalPoints)
Parameters:
totalPoints - The totalPoints to set.

calculateMean

protected Double calculateMean(Collection grades,
                               int numEnrollments)
Calculate the mean for all enrollments, counting null grades as zero.

Specified by:
calculateMean in class GradableObject
Parameters:
grades - A collection of grades as percentage values (Doubles)
Returns:
The mean of all entered grades
See Also:
GradableObject.calculateMean(java.util.Collection, int)