本文整理汇总了Java中org.eclipse.jdt.core.dom.BodyDeclaration.getStartPosition方法的典型用法代码示例。如果您正苦于以下问题:Java BodyDeclaration.getStartPosition方法的具体用法?Java BodyDeclaration.getStartPosition怎么用?Java BodyDeclaration.getStartPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.dom.BodyDeclaration
的用法示例。
在下文中一共展示了BodyDeclaration.getStartPosition方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findFieldInsertIndex
import org.eclipse.jdt.core.dom.BodyDeclaration; //导入方法依赖的package包/类
private int findFieldInsertIndex(List<BodyDeclaration> decls, FieldDeclaration newDecl, int maxOffset) {
if (maxOffset != -1) {
for (int i= decls.size() - 1; i >= 0; i--) {
BodyDeclaration curr= decls.get(i);
if (maxOffset > curr.getStartPosition() + curr.getLength()) {
return BodyDeclarationRewrite.getInsertionIndex(newDecl, decls.subList(0, i + 1));
}
}
return 0;
}
return BodyDeclarationRewrite.getInsertionIndex(newDecl, decls);
}
示例2: findMethodInsertIndex
import org.eclipse.jdt.core.dom.BodyDeclaration; //导入方法依赖的package包/类
private int findMethodInsertIndex(List<BodyDeclaration> decls, int currPos) {
int nDecls= decls.size();
for (int i= 0; i < nDecls; i++) {
BodyDeclaration curr= decls.get(i);
if (curr instanceof MethodDeclaration && currPos < curr.getStartPosition() + curr.getLength()) {
return i + 1;
}
}
return nDecls;
}
示例3: findFieldInsertIndex
import org.eclipse.jdt.core.dom.BodyDeclaration; //导入方法依赖的package包/类
private int findFieldInsertIndex(
List<BodyDeclaration> decls, FieldDeclaration newDecl, int maxOffset) {
if (maxOffset != -1) {
for (int i = decls.size() - 1; i >= 0; i--) {
BodyDeclaration curr = decls.get(i);
if (maxOffset > curr.getStartPosition() + curr.getLength()) {
return ASTNodes.getInsertionIndex(newDecl, decls.subList(0, i + 1));
}
}
return 0;
}
return ASTNodes.getInsertionIndex(newDecl, decls);
}
示例4: findMethodInsertIndex
import org.eclipse.jdt.core.dom.BodyDeclaration; //导入方法依赖的package包/类
private int findMethodInsertIndex(List<BodyDeclaration> decls, int currPos) {
int nDecls = decls.size();
for (int i = 0; i < nDecls; i++) {
BodyDeclaration curr = decls.get(i);
if (curr instanceof MethodDeclaration
&& currPos < curr.getStartPosition() + curr.getLength()) {
return i + 1;
}
}
return nDecls;
}