/** {@inheritDoc} */ public void setMeasure(Metric metric, int measure) { switch (metric) { case BLANK_LINES: blankLine = measure; break; case LINES_OF_CODE: lineOfCode = measure; break; case COMMENT_LINES: commentLine = measure; break; case COMMENTED_OUT_CODE_LINES: commentedOutCodeLine = measure; break; case COMMENT_BLANK_LINES: commentBlankLine = measure; break; case HEADER_COMMENT_LINES: headerCommentLine = measure; break; case PUBLIC_DOC_API: documentation = measure; break; case LINES: throw new IllegalStateException( "Metric LINES always equals 1 on a Line and you are not permitted to change this value."); default: throw new IllegalStateException( "Metric " + metric.name() + " is not suitable for Line object."); } }
/** {@inheritDoc} */ public int getInt(Metric metric) { switch (metric) { case BLANK_LINES: return blankLine; case LINES: return line; case LINES_OF_CODE: return lineOfCode; case COMMENT_LINES: return commentLine; case COMMENTED_OUT_CODE_LINES: return commentedOutCodeLine; case COMMENT_BLANK_LINES: return commentBlankLine; case HEADER_COMMENT_LINES: return headerCommentLine; case PUBLIC_DOC_API: return documentation; default: throw new IllegalStateException( "Metric " + metric.name() + " is not available on Line object."); } }