private String commentContent(final Comment comment) { int _startPosition = comment.getStartPosition(); int _startPosition_1 = comment.getStartPosition(); int _length = comment.getLength(); int _plus = (_startPosition_1 + _length); return this.javaSources.substring(_startPosition, _plus); }
private String getComment(Comment node) { final String source = this.ctx.getSource(node); final int start = node.getStartPosition(); return source.substring(start, start + node.getLength()); } }
/** * @param compilationUnit to use to get a list of comments and node positions * @param source original source used to create compilation unit */ public CommentAwareSourceRangeComputer(CompilationUnit compilationUnit, String source) { this.compilationUnit = compilationUnit; this.source = source; List<?> commentList = compilationUnit.getCommentList(); if (commentList != null) { this.commentArray = commentList.toArray(new Comment[commentList.size()]); this.commentStartPositions = new int [commentList.size()]; this.commentEndPositions = new int [commentList.size()]; int i = 0; for (Iterator<?> iter = commentList.iterator(); iter.hasNext();) { Comment comment = (Comment)iter.next(); commentStartPositions[i] = comment.getStartPosition(); commentEndPositions[i] = commentStartPositions[i] + comment.getLength(); i++; } } else { this.commentArray = new Comment [0]; this.commentStartPositions = new int [0]; this.commentEndPositions = new int [0]; } }
/** * @param compilationUnit to use to get a list of comments and node positions * @param source original source used to create compilation unit */ public CommentAwareSourceRangeComputer(CompilationUnit compilationUnit, String source) { this.compilationUnit = compilationUnit; this.source = source; List<?> commentList = compilationUnit.getCommentList(); if (commentList != null) { this.commentArray = (Comment[])commentList.toArray(); this.commentStartPositions = new int [commentList.size()]; this.commentEndPositions = new int [commentList.size()]; int i = 0; for (Iterator<?> iter = commentList.iterator(); iter.hasNext();) { Comment comment = (Comment)iter.next(); commentStartPositions[i] = comment.getStartPosition(); commentEndPositions[i] = commentStartPositions[i] + comment.getLength(); i++; } } else { this.commentArray = new Comment [0]; this.commentStartPositions = new int [0]; this.commentEndPositions = new int [0]; } }
private void addReplacementEdits(List<TextEdit> commentEdits) { if (this.replacements.isEmpty()) { return; } for (Pair<Comment, String> pair : this.replacements) { final Comment node = pair.getFirst(); final int start = node.getStartPosition(); final int length = node.getLength(); commentEdits.add(new ReplaceEdit(start, length, pair.getSecond())); } }
private void addRemovalEdits(List<TextEdit> commentEdits, String source) { if (this.removals.isEmpty()) { return; } for (Comment node : this.removals) { final int start = node.getStartPosition(); final int length = node.getLength(); // chomp from the end before the start variable gets modified final int startToRemove = chompWhitespacesBefore(source, start); final int endToRemove = chompWhitespacesAfter(source, start + length); final int lengthToRemove = endToRemove - startToRemove; commentEdits.add(new DeleteEdit(startToRemove, lengthToRemove)); } }
private ASTNode getCoveringNode(Comment node) { final int start = node.getStartPosition(); final int length = node.getLength(); final ASTNode coveringNode = getCoveringNode(start, length); if (coveringNode != node) { return coveringNode; } return getCoveringNode(start, length + 1); }
public int getExtendedEnd(ASTNode node) { int end = node.getStartPosition() + node.getLength(); if (this.trailingPtr >= 0) { long range = -1; for (int i=0; range<0 && i<=this.trailingPtr; i++) { if (this.trailingNodes[i] == node) range = this.trailingIndexes[i]; } if (range >= 0) { Comment lastComment = this.comments[(int) range]; end = lastComment.getStartPosition() + lastComment.getLength(); } } return end-1; }
public int getExtendedEnd(ASTNode node) { int end = node.getStartPosition() + node.getLength(); if (this.trailingPtr >= 0) { long range = -1; for (int i=0; range<0 && i<=this.trailingPtr; i++) { if (this.trailingNodes[i] == node) range = this.trailingIndexes[i]; } if (range >= 0) { Comment lastComment = this.comments[(int) range]; end = lastComment.getStartPosition() + lastComment.getLength(); } } return end-1; }
public int getExtendedEnd(ASTNode node) { int end = node.getStartPosition() + node.getLength(); if (this.trailingPtr >= 0) { long range = -1; for (int i=0; range<0 && i<=this.trailingPtr; i++) { if (this.trailingNodes[i] == node) range = this.trailingIndexes[i]; } if (range >= 0) { Comment lastComment = this.comments[(int) range]; end = lastComment.getStartPosition() + lastComment.getLength(); } } return end-1; }
public int getExtendedEnd(ASTNode node) { int end = node.getStartPosition() + node.getLength(); if (this.trailingPtr >= 0) { long range = -1; for (int i=0; range<0 && i<=this.trailingPtr; i++) { if (this.trailingNodes[i] == node) range = this.trailingIndexes[i]; } if (range >= 0) { Comment lastComment = this.comments[(int) range]; end = lastComment.getStartPosition() + lastComment.getLength(); } } return end-1; }
public int getExtendedEnd(ASTNode node) { int end = node.getStartPosition() + node.getLength(); if (this.trailingPtr >= 0) { long range = -1; for (int i=0; range<0 && i<=this.trailingPtr; i++) { if (this.trailingNodes[i] == node) range = this.trailingIndexes[i]; } if (range >= 0) { Comment lastComment = this.comments[(int) range]; end = lastComment.getStartPosition() + lastComment.getLength(); } } return end-1; }
while (currentComment != null) { int currentCommentStartPosition = currentComment.getStartPosition(); int currentCommentLength = currentComment.getLength();
while (currentComment != null) { int currentCommentStartPosition = currentComment.getStartPosition(); int currentCommentLength = currentComment.getLength();
public int getExtendedEnd(ASTNode node) { int end = node.getStartPosition() + node.getLength(); if (this.trailingPtr >= 0) { long range = -1; for (int i=0; range<0 && i<=this.trailingPtr; i++) { if (this.trailingNodes[i] == node) range = this.trailingIndexes[i]; } if (range >= 0) { Comment lastComment = this.comments[(int) range]; end = lastComment.getStartPosition() + lastComment.getLength(); } } return end-1; }
if (position < commentStart) { top = i-1; } else if (position >=(commentStart+comment.getLength())) { bottom = i+1; } else {
if (position < commentStart) { top = i-1; } else if (position >=(commentStart+comment.getLength())) { bottom = i+1; } else {
private ASTNode getNextNode(Comment node) { final int nodeEndPosition = node.getStartPosition() + node.getLength(); final ASTNode coveringNode = getCoveringNode(node); final int parentNodeEndPosition = coveringNode.getStartPosition() + coveringNode.getLength(); final NodeFinder finder = new NodeFinder(coveringNode, nodeEndPosition, parentNodeEndPosition - nodeEndPosition); if (node instanceof Javadoc) { return finder.getCoveringNode(); } return finder.getCoveredNode(); }
int commentEndPos = commentStartPos + commentArray[firstTrailingCommentIndex].getLength(); if (compilationUnit.getLineNumber(commentStartPos) == compilationUnit.getLineNumber(nodeEnd))
int commentEndPos = commentStartPos + commentArray[firstTrailingCommentIndex].getLength(); if (compilationUnit.getLineNumber(commentStartPos) == compilationUnit.getLineNumber(position))