/** * Checks if given comment is legal (single-line and matches to the * pattern). * @param comment comment to check. * @return true if the comment if legal. */ private boolean isLegalComment(final TextBlock comment) { final boolean legal; // multi-line comment can not be legal if (legalComment == null || comment.getStartLineNo() != comment.getEndLineNo()) { legal = false; } else { String commentText = comment.getText()[0]; // remove chars which start comment commentText = commentText.substring(2); // if this is a C-style comment we need to remove its end if (commentText.endsWith("*/")) { commentText = commentText.substring(0, commentText.length() - 2); } commentText = commentText.trim(); legal = legalComment.matcher(commentText).find(); } return legal; }
/** * Checks if given comment is legal (single-line and matches to the * pattern). * @param comment comment to check. * @return true if the comment if legal. */ private boolean isLegalComment(final TextBlock comment) { final boolean legal; // multi-line comment can not be legal if (legalComment == null || comment.getStartLineNo() != comment.getEndLineNo()) { legal = false; } else { String commentText = comment.getText()[0]; // remove chars which start comment commentText = commentText.substring(2); // if this is a C-style comment we need to remove its end if (commentText.endsWith("*/")) { commentText = commentText.substring(0, commentText.length() - 2); } commentText = commentText.trim(); legal = legalComment.matcher(commentText).find(); } return legal; }