Class JavadocUtilizingTrailingSpaceCheck.JavadocLine
java.lang.Object
com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocUtilizingTrailingSpaceCheck.JavadocLine
- Enclosing class:
JavadocUtilizingTrailingSpaceCheck
Represents a logical line in a Javadoc comment.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate DetailNodeThe first node with content on this line, the location of violations.private StringThe first word of the line, used for pull calculations.private booleanWhether the line has content after its leading inline tag.private booleanWhether the line has meaningful content.private intThe length of the line (end column).private final intThe source line number.private booleanWhether skipped lines follow this line, so the next line is not adjacent.private booleanWhether the line starts with a Javadoc block tag.private booleanWhether the line starts with an HTML tag.private booleanWhether the line starts with an inline tag.private booleanWhether the line starts with an unbreakable element (inline tag or URL). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate intReturns the length of the first word on this line.private voidinitContent(String trimmedText, Pattern urlPattern, DetailNode textNode) Initializes content state for the first non-empty text on this line.private booleanChecks whether the only content of this line is a single inline tag, which may exceed the limit.private voidmarkAdditionalContent(String text) Marks the line as having additional content when the given text, which follows the first content of the line, contains a separate word.private voidupdateLength(int startColumn, int contentLength) Updates the line length based on column position and content length.
-
Field Details
-
lineNumber
private final int lineNumberThe source line number. -
firstNode
The first node with content on this line, the location of violations. -
length
private int lengthThe length of the line (end column). -
hasContent
private boolean hasContentWhether the line has meaningful content. -
startsWithUnbreakable
private boolean startsWithUnbreakableWhether the line starts with an unbreakable element (inline tag or URL). -
startsWithInlineTag
private boolean startsWithInlineTagWhether the line starts with an inline tag. -
hasAdditionalContent
private boolean hasAdditionalContentWhether the line has content after its leading inline tag. -
startsWithBlockTag
private boolean startsWithBlockTagWhether the line starts with a Javadoc block tag. -
startsWithHtml
private boolean startsWithHtmlWhether the line starts with an HTML tag. -
skippedLinesFollow
private boolean skippedLinesFollowWhether skipped lines follow this line, so the next line is not adjacent. -
firstWord
The first word of the line, used for pull calculations.
-
-
Constructor Details
-
JavadocLine
private JavadocLine(int lineNumber) Creates a JavadocLine.- Parameters:
lineNumber- the source line number
-
-
Method Details
-
updateLength
private void updateLength(int startColumn, int contentLength) Updates the line length based on column position and content length.- Parameters:
startColumn- the starting column (0-indexed)contentLength- the length of the content
-
initContent
Initializes content state for the first non-empty text on this line.- Parameters:
trimmedText- the trimmed text contenturlPattern- pattern used to detect URLstextNode- the node of the text content
-
markAdditionalContent
Marks the line as having additional content when the given text, which follows the first content of the line, contains a separate word. Text attached to the preceding element, such as trailing punctuation, is not additional content.- Parameters:
text- the text that follows the first content of the line
-
isOnlyInlineTag
private boolean isOnlyInlineTag()Checks whether the only content of this line is a single inline tag, which may exceed the limit.- Returns:
- true if the line contains only an inline tag
-
firstWordLength
private int firstWordLength()Returns the length of the first word on this line.- Returns:
- the first word length
-