예제 #1
0
 @Override
 public Object[] getViolationParameters(DataPoint point) {
   return new String[] {
     ((ASTMethodDeclaration) point.getNode()).getMethodName(),
     String.valueOf((int) point.getScore())
   };
 }
예제 #2
0
  @Override
  public Object visit(ASTMethodDeclaration node, Object data) {
    int npath = complexityMultipleOf(node, 1, data);

    DataPoint point = new DataPoint();
    point.setNode(node);
    point.setScore(1.0 * npath);
    point.setMessage(getMessage());
    addDataPoint(point);

    return Integer.valueOf(npath);
  }
예제 #3
0
 public int compareTo(DataPoint rhs) {
   Double lhsScore = new Double(score);
   Double rhsScore = new Double(rhs.getScore());
   if (lhsScore.doubleValue() != rhsScore.doubleValue()) {
     return lhsScore.compareTo(rhsScore);
   }
   return random - rhs.random;
 }
예제 #4
0
  @Override
  public Object visit(ASTProgramUnit node, Object data) {
    LOGGER.entering(CLASS_NAME, "visit(ASTProgramUnit)");
    int npath = complexityMultipleOf(node, 1, data);

    DataPoint point = new DataPoint();
    point.setNode(node);
    point.setScore(1.0 * npath);
    point.setMessage(getMessage());
    addDataPoint(point);

    if (LOGGER.isLoggable(Level.FINEST)) {
      LOGGER.finest(
          "NPath complexity:  "
              + npath
              + " for line "
              + node.getBeginLine()
              + ", column "
              + node.getBeginColumn());
    }
    LOGGER.exiting(CLASS_NAME, "visit(ASTProgramUnit)", npath);
    return Integer.valueOf(npath);
  }