本文整理了Java中net.sourceforge.pmd.lang.ast.Node.getEndColumn()
方法的一些代码示例,展示了Node.getEndColumn()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getEndColumn()
方法的具体详情如下:
包路径:net.sourceforge.pmd.lang.ast.Node
类名称:Node
方法名:getEndColumn
暂无
代码示例来源:origin: pmd/pmd
@Override
public int getEndColumn() {
if (this.endColumn > 0) {
return this.endColumn;
}
Node parent = jjtGetParent();
if (parent != null) {
return parent.getEndColumn();
}
throw new RuntimeException("Unable to determine ending column of Node.");
}
代码示例来源:origin: pmd/pmd
private boolean isCommentNotWithin(FormalComment n1, Node n2, Node node) {
if (n1 == null || n2 == null || node == null) {
return true;
}
boolean isNotWithinNode2 = !(n1.getEndLine() < n2.getEndLine()
|| n1.getEndLine() == n2.getEndLine() && n1.getEndColumn() < n2.getEndColumn());
boolean isNotSameClass = node.getFirstParentOfType(ASTClassOrInterfaceBody.class) != n2
.getFirstParentOfType(ASTClassOrInterfaceBody.class);
boolean isNodeWithinNode2 = node.getEndLine() < n2.getEndLine()
|| node.getEndLine() == n2.getEndLine() && node.getEndColumn() < n2.getEndColumn();
return isNotWithinNode2 || isNotSameClass || isNodeWithinNode2;
}
代码示例来源:origin: pmd/pmd
private static boolean isAfter(Node n1, Node n2) {
return n1.getBeginLine() > n2.getBeginLine()
|| n1.getBeginLine() == n2.getBeginLine() && n1.getBeginColumn() >= n2.getEndColumn();
}
代码示例来源:origin: pmd/pmd
public ParametricRuleViolation(Rule theRule, RuleContext ctx, T node, String message) {
rule = theRule;
description = message;
filename = ctx.getSourceCodeFilename();
if (filename == null) {
filename = "";
}
if (node != null) {
beginLine = node.getBeginLine();
beginColumn = node.getBeginColumn();
endLine = node.getEndLine();
endColumn = node.getEndColumn();
}
// Apply Rule specific suppressions
if (node != null && rule != null) {
setSuppression(rule, node);
}
}
代码示例来源:origin: pmd/pmd
/**
* Snapshots the absolute coordinates of the node in the code area
* for the duration of the layering algorithm.
*/
// TODO I don't think there's any good reason for this laziness,
// if anything, it may cause trouble if the layering algorithm uses
// a snapshot taken too late, with outdated line and column coordinates
// I originally wrote it like that because I didn't think enough about it,
// and I don't have time to simplify it before 6.5.0
public PositionSnapshot snapshot() {
int lastKnownStart = getAbsolutePosition(node.getBeginLine(), node.getBeginColumn() - 1);
int lastKnownEnd = getAbsolutePosition(node.getEndLine(), node.getEndColumn());
return new PositionSnapshot(lastKnownStart, lastKnownEnd);
}
代码示例来源:origin: pmd/pmd
public void select(Node node) {
String[] lines = getLines();
if (node.getBeginLine() >= 0) {
setSelectionStart(getPosition(lines, node.getBeginLine(), node.getBeginColumn()));
setSelectionEnd(getPosition(lines, node.getEndLine(), node.getEndColumn()) + 1);
}
requestFocus();
}
}
代码示例来源:origin: pmd/pmd
@Override
public void run() {
try {
sourceCodeArea.getHighlighter().removeAllHighlights();
if (node == null) {
return;
}
int startOffset = sourceCodeArea.getLineStartOffset(node.getBeginLine() - 1)
+ node.getBeginColumn() - 1;
int end = sourceCodeArea.getLineStartOffset(node.getEndLine() - 1) + node.getEndColumn();
sourceCodeArea.getHighlighter().addHighlight(startOffset, end,
new DefaultHighlighter.DefaultHighlightPainter(HIGHLIGHT_COLOR));
sourceCodeArea.moveCaretPosition(startOffset);
} catch (BadLocationException exc) {
throw new IllegalStateException(exc.getMessage());
}
}
});
代码示例来源:origin: pmd/pmd
if (argument.jjtGetChild(0).getEndColumn() > longestParameterEndColumn) {
longestParameterEndColumn = argument.jjtGetChild(0).getEndColumn();
代码示例来源:origin: net.sourceforge.pmd/pmd-apex
@Override
public int getEndColumn() {
if (this.endColumn > 0) {
return this.endColumn;
}
Node parent = jjtGetParent();
if (parent != null) {
return parent.getEndColumn();
}
throw new RuntimeException("Unable to determine ending column of Node.");
}
代码示例来源:origin: net.sourceforge.pmd/pmd-java
private boolean isCommentNotWithin(FormalComment n1, Node n2, Node node) {
if (n1 == null || n2 == null || node == null) {
return true;
}
boolean isNotWithinNode2 = !(n1.getEndLine() < n2.getEndLine()
|| n1.getEndLine() == n2.getEndLine() && n1.getEndColumn() < n2.getEndColumn());
boolean isNotSameClass = node.getFirstParentOfType(ASTClassOrInterfaceBody.class) != n2
.getFirstParentOfType(ASTClassOrInterfaceBody.class);
boolean isNodeWithinNode2 = node.getEndLine() < n2.getEndLine()
|| node.getEndLine() == n2.getEndLine() && node.getEndColumn() < n2.getEndColumn();
return isNotWithinNode2 || isNotSameClass || isNodeWithinNode2;
}
代码示例来源:origin: net.sourceforge.pmd/pmd-java
private static boolean isAfter(Node n1, Node n2) {
return n1.getBeginLine() > n2.getBeginLine()
|| n1.getBeginLine() == n2.getBeginLine() && n1.getBeginColumn() >= n2.getEndColumn();
}
代码示例来源:origin: net.sourceforge.pmd/pmd-core
public ParametricRuleViolation(Rule theRule, RuleContext ctx, T node, String message) {
rule = theRule;
description = message;
filename = ctx.getSourceCodeFilename();
if (filename == null) {
filename = "";
}
if (node != null) {
beginLine = node.getBeginLine();
beginColumn = node.getBeginColumn();
endLine = node.getEndLine();
endColumn = node.getEndColumn();
}
// Apply Rule specific suppressions
if (node != null && rule != null) {
setSuppression(rule, node);
}
}
代码示例来源:origin: net.sourceforge.pmd/pmd-core
public void select(Node node) {
String[] lines = getLines();
if (node.getBeginLine() >= 0) {
setSelectionStart(getPosition(lines, node.getBeginLine(), node.getBeginColumn()));
setSelectionEnd(getPosition(lines, node.getEndLine(), node.getEndColumn()) + 1);
}
requestFocus();
}
}
代码示例来源:origin: net.sourceforge.pmd/pmd-core
@Override
public void run() {
try {
sourceCodeArea.getHighlighter().removeAllHighlights();
if (node == null) {
return;
}
int startOffset = sourceCodeArea.getLineStartOffset(node.getBeginLine() - 1)
+ node.getBeginColumn() - 1;
int end = sourceCodeArea.getLineStartOffset(node.getEndLine() - 1) + node.getEndColumn();
sourceCodeArea.getHighlighter().addHighlight(startOffset, end,
new DefaultHighlighter.DefaultHighlightPainter(HIGHLIGHT_COLOR));
sourceCodeArea.moveCaretPosition(startOffset);
} catch (BadLocationException exc) {
throw new IllegalStateException(exc.getMessage());
}
}
});
内容来源于网络,如有侵权,请联系作者删除!