Class SyntaxConditionCountGrader

Direct Known Subclasses:
ExpressionStatementCountGrader, SyntaxConditionGrader

public abstract class SyntaxConditionCountGrader extends SyntaxCountGrader
A grader that counts whether the number of parse nodes satisfying a given predicate is in the specified range.
See Also:
  • Node
  • 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 grader
      countedName - the name of the element(s) being counted
      maxScore - the score if the condition holds
      minCount - the minimum number of occurrences, which must be non-negative
      maxCount - the maximum number of occurrences, or Integer.MAX_VALUE if there is no limit
      predicate - the condition
      Throws:
      ClientException - if minCount < 0, maxCount < minCount, or minCount is 0 when maxCount is Integer.MAX_VALUE