Class SyntaxConditionCountGrader
java.lang.Object
com.spertus.jacquard.common.Grader
com.spertus.jacquard.syntaxgrader.SyntaxGrader
com.spertus.jacquard.syntaxgrader.SyntaxCountGrader
com.spertus.jacquard.syntaxgrader.SyntaxConditionCountGrader
- Direct Known Subclasses:
ExpressionStatementCountGrader
,SyntaxConditionGrader
A grader that counts whether the number of parse nodes satisfying a given
predicate is in the specified range.
- See Also:
-
Node
-
Constructor Summary
ConstructorDescriptionSyntaxConditionCountGrader
(String name, String countedName, double maxScore, int minCount, int maxCount, Predicate<com.github.javaparser.ast.Node> predicate) Creates a new counter to test whether the number of parse nodes satisfying the predicate is within the specified range. -
Method Summary
Methods inherited from class com.spertus.jacquard.syntaxgrader.SyntaxCountGrader
getResult, grade
Methods inherited from class com.spertus.jacquard.syntaxgrader.SyntaxGrader
getCallableSingleTarget
Methods inherited from class com.spertus.jacquard.common.Grader
getCallableMultiTarget, grade, grade, gradeAll, makeExceptionResult, makeExceptionResultList, makeFailureResult, makeFailureResultList, makePartialCreditResult, makeSuccessResult, makeSuccessResultList
-
Constructor Details
-
SyntaxConditionCountGrader
public SyntaxConditionCountGrader(String name, String countedName, double maxScore, int minCount, int maxCount, Predicate<com.github.javaparser.ast.Node> predicate) Creates a new counter to test whether the number of parse nodes satisfying the predicate is within the specified range.- Parameters:
name
- the name of this gradercountedName
- the name of the element(s) being countedmaxScore
- the score if the condition holdsminCount
- the minimum number of occurrences, which must be non-negativemaxCount
- the maximum number of occurrences, orInteger.MAX_VALUE
if there is no limitpredicate
- the condition- Throws:
ClientException
- if minCount < 0, maxCount < minCount, or minCount is 0 when maxCount isInteger.MAX_VALUE
-