Package com.spertus.jacquard.common
Class Result
java.lang.Object
com.spertus.jacquard.common.Result
- Direct Known Subclasses:
ExceptionResult
The result of an evaluation of student code.
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionCreates a result with the visibility level specified inAutograder.visibility
.Result
(String name, double score, double maxScore, String message, Visibility visibility) Creates a result with the specified properties. -
Method Summary
Modifier and TypeMethodDescriptionchangeVisibility
(Visibility visibility) Changes the visibility of this result and returns it.static void
changeVisibility
(List<Result> results, Visibility visibility) Changes the visibility of all the results.boolean
double
Gets the maximum possible score of the test associated with this result.Gets the message with any additional information about this result.getName()
Gets the name of this result.double
getScore()
Gets the score (points earned) of this result.Gets the visibility level of this result.int
hashCode()
static Result
makeAllOrNothing
(List<Result> results, String name, String allMessage, String nothingMessage, double maxScore, boolean includeMessages) Creates a single result summarizing a list of results, giving credit only if all the results indicate complete success (having a score equal to the maximum score}.static Result
Makes a result indicating an exceptional event occurredstatic Result
makeFailure
(String name, double maxScore, String message) Makes a result indicating a total failure.static Result
makeFailure
(String name, double maxScore, String message, Visibility visibility) Makes a result with the specified visibility level indicating a total failure.static Result
makeResult
(String name, double actualScore, double maxScore, String message) Makes a result with the provided score and message with the visibility level specified inAutograder.visibility
.static Result
makeResult
(String name, double actualScore, double maxScore, String message, Visibility visibility) Makes a result with the provided characteristics.static Result
makeSuccess
(String name, double score, String message) Makes a result indicating a total success.static Result
makeSuccess
(String name, double score, String message, Visibility visibility) Makes a result indicating a total success.reorderResults
(List<Result> results, Result.Order order) Produces a sorted copy of the results.void
setVisibility
(Visibility visibility) Sets the visibility of this result.
-
Constructor Details
-
Result
Creates a result with the specified properties.- Parameters:
name
- the name of the checkerscore
- the actual scoremaxScore
- the maximum possible scoremessage
- an explanation of the result or the empty stringvisibility
- the visibility of the result to the student
-
Result
Creates a result with the visibility level specified inAutograder.visibility
.- Parameters:
name
- the name of the checkerscore
- the actual scoremaxScore
- the maximum possible scoremessage
- an explanation of the result or the empty string
-
-
Method Details
-
getName
Gets the name of this result.- Returns:
- the name
-
getScore
public double getScore()Gets the score (points earned) of this result.- Returns:
- the score
-
getMaxScore
public double getMaxScore()Gets the maximum possible score of the test associated with this result.- Returns:
- the maximum score
-
getMessage
Gets the message with any additional information about this result.- Returns:
- the message, possibly the empty string
-
getVisibility
Gets the visibility level of this result.- Returns:
- the visibility
-
setVisibility
Sets the visibility of this result.- Parameters:
visibility
- the visibility
-
changeVisibility
Changes the visibility of this result and returns it.- Parameters:
visibility
- the visibility- Returns:
- this result with the new visibility
-
equals
-
hashCode
public int hashCode() -
makeError
Makes a result indicating an exceptional event occurred -
makeResult
Makes a result with the provided score and message with the visibility level specified inAutograder.visibility
.- Parameters:
name
- the nameactualScore
- the number of points earnedmaxScore
- the number of points possiblemessage
- any message- Returns:
- a result
-
makeResult
public static Result makeResult(String name, double actualScore, double maxScore, String message, Visibility visibility) Makes a result with the provided characteristics.- Parameters:
name
- the nameactualScore
- the number of points earnedmaxScore
- the number of points possiblemessage
- any messagevisibility
- the visibility- Returns:
- a result
-
makeSuccess
Makes a result indicating a total success.- Parameters:
name
- the namescore
- the number of points earnedmessage
- any message- Returns:
- a result
-
makeSuccess
Makes a result indicating a total success.- Parameters:
name
- the namescore
- the number of points earnedmessage
- any messagevisibility
- the visibility level- Returns:
- a result
-
makeFailure
Makes a result indicating a total failure.- Parameters:
name
- the namemaxScore
- the number of points not earnedmessage
- any message- Returns:
- a result
-
makeFailure
public static Result makeFailure(String name, double maxScore, String message, Visibility visibility) Makes a result with the specified visibility level indicating a total failure.- Parameters:
name
- the namemaxScore
- the number of points not earnedmessage
- any messagevisibility
- the visibility level- Returns:
- a result
-
makeAllOrNothing
public static Result makeAllOrNothing(List<Result> results, String name, String allMessage, String nothingMessage, double maxScore, boolean includeMessages) Creates a single result summarizing a list of results, giving credit only if all the results indicate complete success (having a score equal to the maximum score}. Otherwise, the returned result has a score of 0.The message of the new result begins with either
allMessage
(for all successful) ornothingMessage
. IfincludeMessages
is true, the messages of the individual results will be appended to the message of the produced result.All of the passed results must have the same visibility level, which will be used for the created result.
- Parameters:
results
- the results to summarizename
- the name of the created resultallMessage
- the message to include if all results are successfulnothingMessage
- the message to include if any results are not successfulmaxScore
- the score if all results are successfulincludeMessages
- whether to include the messages of the results- Returns:
- a new result
- Throws:
IllegalArgumentException
- if all the passed results do not have the same visibility level or if there are no passed results
-
changeVisibility
Changes the visibility of all the results.- Parameters:
results
- the resultsvisibility
- the new visibility
-
reorderResults
Produces a sorted copy of the results.- Parameters:
results
- the resultsorder
- the ordering- Returns:
- the sorted result list
-