本文整理汇总了Java中com.puppycrawl.tools.checkstyle.api.DetailNode.getLineNumber方法的典型用法代码示例。如果您正苦于以下问题:Java DetailNode.getLineNumber方法的具体用法?Java DetailNode.getLineNumber怎么用?Java DetailNode.getLineNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.puppycrawl.tools.checkstyle.api.DetailNode
的用法示例。
在下文中一共展示了DetailNode.getLineNumber方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getValueAtDetailNode
import com.puppycrawl.tools.checkstyle.api.DetailNode; //导入方法依赖的package包/类
/**
* Gets a value for DetailNode object.
* @param node DetailNode(Javadoc) node.
* @param column column index.
* @return value at specified column.
*/
private static Object getValueAtDetailNode(DetailNode node, int column) {
final Object value;
switch (column) {
case 0:
// first column is tree model. no value needed
value = null;
break;
case 1:
value = JavadocUtils.getTokenName(node.getType());
break;
case 2:
value = node.getLineNumber();
break;
case 3:
value = node.getColumnNumber();
break;
case 4:
value = node.getText();
break;
default:
throw new IllegalStateException(UNKNOWN_COLUMN_MSG);
}
return value;
}
示例2: checkParagraphTag
import com.puppycrawl.tools.checkstyle.api.DetailNode; //导入方法依赖的package包/类
/**
* Determines whether or not the line with paragraph tag has previous empty line.
* @param tag html tag.
*/
private void checkParagraphTag(DetailNode tag) {
final DetailNode newLine = getNearestEmptyLine(tag);
if (isFirstParagraph(tag)) {
log(tag.getLineNumber(), MSG_REDUNDANT_PARAGRAPH);
}
else if (newLine == null || tag.getLineNumber() - newLine.getLineNumber() != 1) {
log(tag.getLineNumber(), MSG_LINE_BEFORE);
}
if (allowNewlineParagraph && isImmediatelyFollowedByText(tag)) {
log(tag.getLineNumber(), MSG_MISPLACED_TAG);
}
}
示例3: adjustFirstLineToJavadocIndent
import com.puppycrawl.tools.checkstyle.api.DetailNode; //导入方法依赖的package包/类
/**
* Adjust first line nodes to javadoc indent.
* @param tree DetailNode tree root
* @param javadocColumnNumber javadoc indent
*/
private void adjustFirstLineToJavadocIndent(DetailNode tree, int javadocColumnNumber) {
if (tree.getLineNumber() == blockCommentLineNumber) {
((JavadocNodeImpl) tree).setColumnNumber(tree.getColumnNumber() + javadocColumnNumber);
final DetailNode[] children = tree.getChildren();
for (DetailNode child : children) {
adjustFirstLineToJavadocIndent(child, javadocColumnNumber);
}
}
}