Package com.spertus.jacquard.common
Class Grader
java.lang.Object
com.spertus.jacquard.common.Grader
- Direct Known Subclasses:
CheckstyleGrader,PmdGrader,SyntaxGrader
The superclass of all graders.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetCallableMultiTarget(Target... targets) Gets aCallablethrough which this grader can be called on multiple targets.getCallableSingleTarget(Target target) Gets aCallablethrough which this grader can be called on a single target.Grades the provided targets.Grades the provided targets.Runs all graders on the provided target.protected ResultmakeExceptionResult(Throwable throwable) Creates a result when a grader threw an exception instead of returning a result.makeExceptionResultList(Throwable throwable) Creates a one-element list holding the result for a single unhandled throwable.protected ResultmakeFailureResult(double maxPoints, String message) Creates a result for a completely unsuccessful outcome.makeFailureResultList(double maxPoints, String message) Creates a one-element list holding the result of a completely unsuccessful outcome.protected ResultmakePartialCreditResult(double points, double maxPoints, String message) Creates a result indicating partial credit.protected ResultmakeSuccessResult(double maxPoints, String message) Creates a result for a fully successful outcome.makeSuccessResultList(double maxPoints, String message) Creates a one-element list holding a result indicating complete success.
-
Constructor Details
-
Grader
Creates a grader.- Parameters:
name- the name of the grader- Throws:
ClientException- ifAutograderhas not been initialized
-
-
Method Details
-
getCallableSingleTarget
Gets aCallablethrough which this grader can be called on a single target.- Parameters:
target- the target- Returns:
- a
Callablethrough which this grader can be called
-
getCallableMultiTarget
Gets aCallablethrough which this grader can be called on multiple targets. The default implementation just appends the results of successive calls togetCallableSingleTarget(Target), but subclasses may provide their own implementations to handle multiple targets specially.- Parameters:
targets- the targets- Returns:
- a
Callablethrough which this grader can be called
-
grade
Grades the provided targets.- Parameters:
targets- the targets- Returns:
- the results
- Throws:
ClientException- ifAutograderhas not been initialized
-
grade
Grades the provided targets.- Parameters:
targets- the targets- Returns:
- the results
- Throws:
ClientException- ifAutograderhas not been initialized
-
gradeAll
Runs all graders on the provided target.- Parameters:
target- the target for each of the gradersgraders- graders, in the order they should be run- Returns:
- the collected results
- Throws:
ClientException- ifAutograderhas not been initialized
-
makeSuccessResultList
Creates a one-element list holding a result indicating complete success.- Parameters:
maxPoints- the maximum number of points, all of which are earnedmessage- any message to include- Returns:
- the result
-
makeSuccessResult
Creates a result for a fully successful outcome.- Parameters:
maxPoints- the maximum number of points, all of which are awardedmessage- any message to include- Returns:
- the result
-
makeFailureResultList
Creates a one-element list holding the result of a completely unsuccessful outcome.- Parameters:
maxPoints- the maximum number of points, none of which are awardedmessage- any message to include- Returns:
- the result
-
makeFailureResult
Creates a result for a completely unsuccessful outcome.- Parameters:
maxPoints- the maximum number of points, none of which are earnedmessage- any message to include- Returns:
- the result
-
makeExceptionResultList
Creates a one-element list holding the result for a single unhandled throwable.- Parameters:
throwable- the unhandled throwable- Returns:
- the result
-
makeExceptionResult
Creates a result when a grader threw an exception instead of returning a result.- Parameters:
throwable- the unhandled throwable- Returns:
- the result
-
makePartialCreditResult
Creates a result indicating partial credit.- Parameters:
points- the number of points awardedmaxPoints- the maximum possible pointsmessage- any message- Returns:
- the result
-