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
-
Method Summary
Modifier and TypeMethodDescriptiongetCallableMultiTarget
(Target... targets) Gets aCallable
through which this grader can be called on multiple targets.getCallableSingleTarget
(Target target) Gets aCallable
through 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 Result
makeExceptionResult
(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 Result
makeFailureResult
(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 Result
makePartialCreditResult
(double points, double maxPoints, String message) Creates a result indicating partial credit.protected Result
makeSuccessResult
(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
- ifAutograder
has not been initialized
-
-
Method Details
-
getCallableSingleTarget
Gets aCallable
through which this grader can be called on a single target.- Parameters:
target
- the target- Returns:
- a
Callable
through which this grader can be called
-
getCallableMultiTarget
Gets aCallable
through 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
Callable
through which this grader can be called
-
grade
Grades the provided targets.- Parameters:
targets
- the targets- Returns:
- the results
- Throws:
ClientException
- ifAutograder
has not been initialized
-
grade
Grades the provided targets.- Parameters:
targets
- the targets- Returns:
- the results
- Throws:
ClientException
- ifAutograder
has 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
- ifAutograder
has 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
-