Class SyntaxCountGrader
java.lang.Object
com.spertus.jacquard.common.Grader
com.spertus.jacquard.syntaxgrader.SyntaxGrader
com.spertus.jacquard.syntaxgrader.SyntaxCountGrader
- Direct Known Subclasses:
StringInterpolationCountGrader,SyntaxConditionCountGrader
The base class for counters to test whether the number of occurrences of a
syntactic element is within the specified range.
-
Constructor Summary
ConstructorsConstructorDescriptionSyntaxCountGrader(String name, String countedName, double maxScore, int minCount, int maxCount, com.github.javaparser.ast.visitor.VoidVisitorAdapter<MutableInteger> adapter) Creates a new counter to test whether the number of occurrences of an element is within the specified range. -
Method Summary
Methods inherited from class com.spertus.jacquard.syntaxgrader.SyntaxGrader
getCallableSingleTargetMethods inherited from class com.spertus.jacquard.common.Grader
getCallableMultiTarget, grade, grade, gradeAll, makeExceptionResult, makeExceptionResultList, makeFailureResult, makeFailureResultList, makePartialCreditResult, makeSuccessResult, makeSuccessResultList
-
Constructor Details
-
SyntaxCountGrader
public SyntaxCountGrader(String name, String countedName, double maxScore, int minCount, int maxCount, com.github.javaparser.ast.visitor.VoidVisitorAdapter<MutableInteger> adapter) Creates a new counter to test whether the number of occurrences of an element is within the specified range.- Parameters:
name- the name of this processor (for theResult)countedName- the name of the element (for theResult)maxScore- the score if the condition holdsminCount- the minimum number of occurrencesmaxCount- the maximum number of occurrences, orInteger.MAX_VALUEif there is no limit.adapter- an adapter for visiting nodes in parse tree- Throws:
ClientException- if minCount < 0, maxCount < minCount, or minCount is 0 when maxCount isInteger.MAX_VALUE
-
-
Method Details
-
grade
Description copied from class:SyntaxGraderGrades the parsed compilation unit.- Specified by:
gradein classSyntaxGrader- Parameters:
cu- the parsed compilation unit- Returns:
- the results
-
getResult
Creates a result with an appropriate score and message based on the number of occurrences of the syntactic element.- Parameters:
mi- the number of occurrences of the syntactic element.- Returns:
- the result
-