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