Exemplo n.º 1
0
 @Override
 public Object[] getViolationParameters(DataPoint point) {
   return new String[] {
     ((ASTMethodDeclaration) point.getNode()).getMethodName(),
     String.valueOf((int) point.getScore())
   };
 }
Exemplo n.º 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);
  }
Exemplo n.º 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;
 }
Exemplo n.º 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);
  }