public boolean visit(LineComment node) { int start = node.getStartPosition(); int end = start + node.getLength(); // source is a string representing your source code String comment = source.substring(start, end); System.out.println(comment); return true; }
private int[] getOffsets() { if (this.offsets == null) { if (this.commentList != null) { int nComments= this.commentList.size(); // count the number of line comments int count= 0; for (int i= 0; i < nComments; i++) { Object curr= this.commentList.get(i); if (curr instanceof LineComment) { count++; } } // fill the offset table this.offsets= new int[count]; for (int i= 0, k= 0; i < nComments; i++) { Object curr= this.commentList.get(i); if (curr instanceof LineComment) { LineComment comment= (LineComment) curr; this.offsets[k++]= comment.getStartPosition() + comment.getLength(); } } } else { this.offsets= Util.EMPTY_INT_ARRAY; } } return this.offsets; }
private int[] getOffsets() { if (this.offsets == null) { if (this.commentList != null) { int nComments= this.commentList.size(); // count the number of line comments int count= 0; for (int i= 0; i < nComments; i++) { Object curr= this.commentList.get(i); if (curr instanceof LineComment) { count++; } } // fill the offset table this.offsets= new int[count]; for (int i= 0, k= 0; i < nComments; i++) { Object curr= this.commentList.get(i); if (curr instanceof LineComment) { LineComment comment= (LineComment) curr; this.offsets[k++]= comment.getStartPosition() + comment.getLength(); } } } else { this.offsets= Util.EMPTY_INT_ARRAY; } } return this.offsets; }
private int[] getOffsets() { if (this.offsets == null) { if (this.commentList != null) { int nComments= this.commentList.size(); // count the number of line comments int count= 0; for (int i= 0; i < nComments; i++) { Object curr= this.commentList.get(i); if (curr instanceof LineComment) { count++; } } // fill the offset table this.offsets= new int[count]; for (int i= 0, k= 0; i < nComments; i++) { Object curr= this.commentList.get(i); if (curr instanceof LineComment) { LineComment comment= (LineComment) curr; this.offsets[k++]= comment.getStartPosition() + comment.getLength(); } } } else { this.offsets= Util.EMPTY_INT_ARRAY; } } return this.offsets; }
private int[] getOffsets() { if (this.offsets == null) { if (this.commentList != null) { int nComments= this.commentList.size(); // count the number of line comments int count= 0; for (int i= 0; i < nComments; i++) { Object curr= this.commentList.get(i); if (curr instanceof LineComment) { count++; } } // fill the offset table this.offsets= new int[count]; for (int i= 0, k= 0; i < nComments; i++) { Object curr= this.commentList.get(i); if (curr instanceof LineComment) { LineComment comment= (LineComment) curr; this.offsets[k++]= comment.getStartPosition() + comment.getLength(); } } } else { this.offsets= Util.EMPTY_INT_ARRAY; } } return this.offsets; }
private int[] getOffsets() { if (this.offsets == null) { if (this.commentList != null) { int nComments= this.commentList.size(); // count the number of line comments int count= 0; for (int i= 0; i < nComments; i++) { Object curr= this.commentList.get(i); if (curr instanceof LineComment) { count++; } } // fill the offset table this.offsets= new int[count]; for (int i= 0, k= 0; i < nComments; i++) { Object curr= this.commentList.get(i); if (curr instanceof LineComment) { LineComment comment= (LineComment) curr; this.offsets[k++]= comment.getStartPosition() + comment.getLength(); } } } else { this.offsets= Util.EMPTY_INT_ARRAY; } } return this.offsets; }
private int[] getOffsets() { if (this.offsets == null) { if (this.commentList != null) { int nComments= this.commentList.size(); // count the number of line comments int count= 0; for (int i= 0; i < nComments; i++) { Object curr= this.commentList.get(i); if (curr instanceof LineComment) { count++; } } // fill the offset table this.offsets= new int[count]; for (int i= 0, k= 0; i < nComments; i++) { Object curr= this.commentList.get(i); if (curr instanceof LineComment) { LineComment comment= (LineComment) curr; this.offsets[k++]= comment.getStartPosition() + comment.getLength(); } } } else { this.offsets= Util.EMPTY_INT_ARRAY; } } return this.offsets; }
private void deleteLineCommentAfterNode(List<TextEdit> commentEdits, String source, LineComment lineComment) { final int commentStart = lineComment.getStartPosition(); final int commentLength = lineComment.getLength(); final int nbWhiteSpaces = nbTrailingSpaces(source, commentStart); commentEdits.add(new DeleteEdit(commentStart - nbWhiteSpaces, nbWhiteSpaces + commentLength)); }
ASTNode clone0(AST target) { LineComment result = new LineComment(target); result.setSourceRange(getStartPosition(), getLength()); return result; }
@Override ASTNode clone0(AST target) { LineComment result = new LineComment(target); result.setSourceRange(getStartPosition(), getLength()); return result; }
ASTNode clone0(AST target) { LineComment result = new LineComment(target); result.setSourceRange(getStartPosition(), getLength()); return result; }
ASTNode clone0(AST target) { LineComment result = new LineComment(target); result.setSourceRange(getStartPosition(), getLength()); return result; }
ASTNode clone0(AST target) { LineComment result = new LineComment(target); result.setSourceRange(getStartPosition(), getLength()); return result; }
ASTNode clone0(AST target) { LineComment result = new LineComment(target); result.setSourceRange(getStartPosition(), getLength()); return result; }
@Override public boolean visit(LineComment node) { _compilationUnit.addComment(new CSLineComment(node.getStartPosition(), getText(node.getStartPosition(), node .getLength()))); return false; }