• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Position类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.github.javaparser.Position的典型用法代码示例。如果您正苦于以下问题:Java Position类的具体用法?Java Position怎么用?Java Position使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Position类属于com.github.javaparser包,在下文中一共展示了Position类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: printArguments

import com.github.javaparser.Position; //导入依赖的package包/类
private void printArguments(final NodeList<Expression> args, final Void arg) {
	printer.print("(");
	Position cursorRef = printer.getCursor();
	if (!isNullOrEmpty(args)) {
		for (final Iterator<Expression> i = args.iterator(); i.hasNext(); ) {
			final Expression e = i.next();
			e.accept(this, arg);
			if (i.hasNext()) {
				printer.print(",");
				if (configuration.isColumnAlignParameters()) {
					printer.wrapToColumn(cursorRef.column);
				} else {
					printer.print(" ");
				}
			}
		}
	}
	printer.print(")");
}
 
开发者ID:sfPlayer1,项目名称:Matcher,代码行数:20,代码来源:SrcRemapper.java


示例2: visit

import com.github.javaparser.Position; //导入依赖的package包/类
@Override public void visit(final MethodCallExpr n, final Object arg) {
    Position begin = n.getBegin();
    Position nameBegin = n.getNameExpr().getBegin();
    boolean newLine = nameBegin.line > begin.line;

    printJavaComment(n.getComment(), arg);
    if (n.getScope() != null) {
        n.getScope().accept(this, arg);
        if (newLine) {
            printer.printLn();
            printer.indent();
        }
        printer.print(".");
    }
    printTypeArgs(n.getTypeArgs(), arg);
    printer.print(n.getName());
    printArguments(n.getArgs(), arg);
    if (newLine) {
        printer.unindent();
    }
}
 
开发者ID:theangrydev,项目名称:business-flows,代码行数:22,代码来源:DumpVisitor.java


示例3: valueChanged

import com.github.javaparser.Position; //导入依赖的package包/类
@Override
public void valueChanged( TreeSelectionEvent e) {
    TreeNode clickedNode = (TreeNode)((JTree) e.getSource()).getLastSelectedPathComponent();
    if (clickedNode instanceof VisitableNode) {
        File file = ((VisitableNode) clickedNode).getFile();
        Position position = ((VisitableNode) clickedNode).getPosition();
        visitor.visitNode( file, position);
    }
}
 
开发者ID:bufferhe4d,项目名称:call-IDE,代码行数:10,代码来源:SummaryTree.java


示例4: calculate

import com.github.javaparser.Position; //导入依赖的package包/类
/**
 * Calculates the total chars from beginning to the given position.
 * @param content the string that to make calculations on
 * @param position the position variable that holds row and column numbers
 * @return the index of the string with given row and column number
 */
public static int calculate( String content, Position position) {
    Scanner reader = new Scanner( content);
    int distance = 0;
    for (int i = 1; i < position.line; i++)
        distance += reader.nextLine().length() + 1;
    distance += position.column - 1;
    return distance;
}
 
开发者ID:bufferhe4d,项目名称:call-IDE,代码行数:15,代码来源:PositionCalculator.java


示例5: convertProblem

import com.github.javaparser.Position; //导入依赖的package包/类
private static SyntaxError convertProblem(Problem problem) {
  Position faultyToken = problem.getLocation().get().getBegin().getRange().begin;

  // Ace editor expects line numbers to be zero-based while JavaParser starts from 1.
  int row = faultyToken.line - 1;
  int column = faultyToken.column;
  String text = problem.getMessage();

  return new SyntaxError(row, column, text);
}
 
开发者ID:tdd-pingis,项目名称:tdd-pingpong,代码行数:11,代码来源:JavaSyntaxChecker.java


示例6: getFieldLocation

import com.github.javaparser.Position; //导入依赖的package包/类
private static Location getFieldLocation(
    SearchContext context, File targetFile, FieldDeclaration declaration) throws IOException {
  final List<VariableDeclarator> variables = declaration.getVariables();
  for (final VariableDeclarator variable : variables) {
    final SimpleName simpleName = variable.getName();
    final String name = simpleName.getIdentifier();
    final Optional<Position> begin = simpleName.getBegin();
    if (name.equals(context.name) && begin.isPresent()) {
      final Position position = begin.get();
      return new Location(targetFile.getCanonicalPath(), position.line, position.column);
    }
  }
  return null;
}
 
开发者ID:mopemope,项目名称:meghanada-server,代码行数:15,代码来源:LocationSearcher.java


示例7: toIndex

import com.github.javaparser.Position; //导入依赖的package包/类
/**
 * Converts the javaparser position to the index of the original text.
 * 
 * @param pos
 * @return
 */
private int toIndex(Position pos) {
	int length = 0;
	for (int i = 0; i < pos.line - 1; i++) {
		length += lines[i].length() + 1;
	}
	length += pos.column;
	return length;
}
 
开发者ID:Col-E,项目名称:JRemapper,代码行数:15,代码来源:Context.java


示例8: getPosition

import com.github.javaparser.Position; //导入依赖的package包/类
@Override
public Position getPosition() {
    return position;
}
 
开发者ID:bufferhe4d,项目名称:call-IDE,代码行数:5,代码来源:MethodNode.java


示例9: getBegin

import com.github.javaparser.Position; //导入依赖的package包/类
/**
 * The begin position of this node in the source file.
 */
public Position getBegin() {
    return range.begin;
}
 
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:7,代码来源:Node.java


示例10: getEnd

import com.github.javaparser.Position; //导入依赖的package包/类
/**
 * The end position of this node in the source file.
 */
public Position getEnd() {
    return range.end;
}
 
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:7,代码来源:Node.java


示例11: setBegin

import com.github.javaparser.Position; //导入依赖的package包/类
/**
 * Sets the begin position of this node in the source file.
 */
public Node setBegin(Position begin) {
    range = range.withBegin(begin);
    return this;
}
 
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:8,代码来源:Node.java


示例12: setEnd

import com.github.javaparser.Position; //导入依赖的package包/类
/**
 * Sets the end position of this node in the source file.
 */
public Node setEnd(Position end) {
    range = range.withEnd(end);
    return this;
}
 
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:8,代码来源:Node.java


示例13: isPositionedAfter

import com.github.javaparser.Position; //导入依赖的package包/类
public boolean isPositionedAfter(Position position) {
    return range.isAfter(position);
}
 
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:4,代码来源:Node.java


示例14: isPositionedBefore

import com.github.javaparser.Position; //导入依赖的package包/类
public boolean isPositionedBefore(Position position) {
    return range.isBefore(position);
}
 
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:4,代码来源:Node.java


示例15: getPosition

import com.github.javaparser.Position; //导入依赖的package包/类
/**
 * Enables access to the position of the node on the file
 * @return the position on the file which is linked to the node
 */
Position getPosition();
 
开发者ID:bufferhe4d,项目名称:call-IDE,代码行数:6,代码来源:VisitableNode.java


示例16: visitNode

import com.github.javaparser.Position; //导入依赖的package包/类
/**
 * Goes to the the given file's given position
 * @param file the file to visit
 * @param position the position of the file to visit
 */
public void visitNode( File file, Position position);
 
开发者ID:bufferhe4d,项目名称:call-IDE,代码行数:7,代码来源:NodeVisitor.java



注:本文中的com.github.javaparser.Position类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NettyContext类代码示例发布时间:2022-05-23
下一篇:
Java SessionAttachmentHandler类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap