本文整理汇总了Java中com.puppycrawl.tools.checkstyle.api.DetailNode.getColumnNumber方法的典型用法代码示例。如果您正苦于以下问题:Java DetailNode.getColumnNumber方法的具体用法?Java DetailNode.getColumnNumber怎么用?Java DetailNode.getColumnNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.puppycrawl.tools.checkstyle.api.DetailNode
的用法示例。
在下文中一共展示了DetailNode.getColumnNumber方法的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: findSelectionPositions
import com.puppycrawl.tools.checkstyle.api.DetailNode; //导入方法依赖的package包/类
/**
* Find start and end selection positions from DetailNode line and Column.
* @param detailNode DetailNode node for which selection finds
*/
private void findSelectionPositions(DetailNode detailNode) {
selectionStart = lines2position.get(detailNode.getLineNumber())
+ detailNode.getColumnNumber();
selectionEnd = findLastPosition(detailNode);
}
示例3: findLastPosition
import com.puppycrawl.tools.checkstyle.api.DetailNode; //导入方法依赖的package包/类
/**
* Finds the last position of node without children.
* @param detailNode DetailNode node.
* @return Last position of node without children.
*/
private int findLastPosition(final DetailNode detailNode) {
final int lastPosition;
if (detailNode.getChildren().length == 0) {
lastPosition = lines2position.get(detailNode.getLineNumber())
+ detailNode.getColumnNumber() + detailNode.getText().length();
}
else {
final DetailNode lastChild =
detailNode.getChildren()[detailNode.getChildren().length - 1];
lastPosition = findLastPosition(lastChild);
}
return lastPosition;
}