本文整理汇总了Java中com.github.javaparser.ast.comments.LineComment类的典型用法代码示例。如果您正苦于以下问题:Java LineComment类的具体用法?Java LineComment怎么用?Java LineComment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LineComment类属于com.github.javaparser.ast.comments包,在下文中一共展示了LineComment类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: attributeLineCommentToNodeOrChild
import com.github.javaparser.ast.comments.LineComment; //导入依赖的package包/类
private boolean attributeLineCommentToNodeOrChild(Node node, LineComment lineComment) {
// The node start and end at the same line as the comment,
// let's give to it the comment
if (node.getBegin().line == lineComment.getBegin().line
&& !node.hasComment()) {
if(!(node instanceof Comment)) {
node.setComment(lineComment);
}
return true;
} else {
// try with all the children, sorted by reverse position (so the
// first one is the nearest to the comment
List<Node> children = new LinkedList<Node>();
children.addAll(node.getChildrenNodes());
PositionUtils.sortByBeginPosition(children);
Collections.reverse(children);
for (Node child : children) {
if (attributeLineCommentToNodeOrChild(child, lineComment)) {
return true;
}
}
return false;
}
}
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:27,代码来源:CommentsInserter.java
示例2: withBodyComment
import com.github.javaparser.ast.comments.LineComment; //导入依赖的package包/类
public CodeStubBuilder withBodyComment(String comment) {
// Hack to add some nice whitespace between // and the comment text
if (!comment.startsWith(" ")) {
comment = " " + comment;
}
LineComment commentNode = new LineComment(comment);
clazz.addOrphanComment(commentNode);
return this;
}
开发者ID:tdd-pingis,项目名称:tdd-pingpong,代码行数:12,代码来源:CodeStubBuilder.java
示例3: visit
import com.github.javaparser.ast.comments.LineComment; //导入依赖的package包/类
@Override public void visit(final LineComment n, final Object arg) {
if (!this.printComments) {
return;
}
printer.print("//");
String tmp = n.getContent();
tmp = tmp.replace('\r', ' ');
tmp = tmp.replace('\n', ' ');
printer.printLn(tmp);
}
开发者ID:theangrydev,项目名称:business-flows,代码行数:11,代码来源:DumpVisitor.java
示例4: visit
import com.github.javaparser.ast.comments.LineComment; //导入依赖的package包/类
@Override
public void visit(final LineComment n, final Object arg) {
printer.printLn("LineComment");
if (!this.printComments) {
return;
}
printer.print("//");
String tmp = n.getContent();
tmp = tmp.replace('r', ' ');
tmp = tmp.replace('n', ' ');
printer.printLn(tmp);
}
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:13,代码来源:ASTDumpVisitor.java
示例5: visit
import com.github.javaparser.ast.comments.LineComment; //导入依赖的package包/类
@Override
public JCTree visit(final LineComment n, final Object arg) {
/* Doesn't have to visit the comment at this point
return new AJCLineComment( make.LineComment( ), ( (n.getComment()!=null)?n.getComment().getContent():null ) );
*/
System.err.println("Assigning null at:" + Thread.currentThread().getStackTrace()[1].getLineNumber());
return null;
}
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:9,代码来源:JavaParser2JCTree.java
示例6: doMerge
import com.github.javaparser.ast.comments.LineComment; //导入依赖的package包/类
@Override
public LineComment doMerge(LineComment first, LineComment second) {
LineComment comment = new LineComment();
comment.setContent(first.getContent());
copyPosition(first,comment);
return comment;
}
开发者ID:beihaifeiwu,项目名称:dolphin,代码行数:8,代码来源:LineCommentMerger.java
示例7: visit
import com.github.javaparser.ast.comments.LineComment; //导入依赖的package包/类
@Override public Boolean visit(final LineComment n1, final Node arg) {
final LineComment n2 = (LineComment) arg;
if (!objEquals(n1.getContent(), n2.getContent())) {
return Boolean.FALSE;
}
if (!objEquals(n1.getBeginLine(), n2.getBeginLine())) {
return Boolean.FALSE;
}
return Boolean.TRUE;
}
开发者ID:plum-umd,项目名称:java-sketch,代码行数:14,代码来源:EqualsVisitor.java
示例8: visit
import com.github.javaparser.ast.comments.LineComment; //导入依赖的package包/类
@Override public void visit(final LineComment n, final Object arg) {
if (!this.printComments) {
return;
}
printer.print("//");
String tmp = n.getContent();
tmp = tmp.replace('\r', ' ');
tmp = tmp.replace('\n', ' ');
printer.printLn(tmp);
}
开发者ID:plum-umd,项目名称:java-sketch,代码行数:11,代码来源:DumpVisitor.java
示例9: attributeLineCommentToNodeOrChild
import com.github.javaparser.ast.comments.LineComment; //导入依赖的package包/类
private static boolean attributeLineCommentToNodeOrChild(Node node, LineComment lineComment)
{
// The node start and end at the same line as the comment,
// let's give to it the comment
if (node.getBeginLine()==lineComment.getBeginLine() && !node.hasComment())
{
node.setComment(lineComment);
return true;
} else {
// try with all the children, sorted by reverse position (so the
// first one is the nearest to the comment
List<Node> children = new LinkedList<Node>();
children.addAll(node.getChildrenNodes());
PositionUtils.sortByBeginPosition(children);
Collections.reverse(children);
for (Node child : children)
{
if (attributeLineCommentToNodeOrChild(child, lineComment))
{
return true;
}
}
return false;
}
}
开发者ID:plum-umd,项目名称:java-sketch,代码行数:28,代码来源:JavaParser.java
示例10: visit
import com.github.javaparser.ast.comments.LineComment; //导入依赖的package包/类
@Override public Boolean visit(final LineComment n1, final Node arg) {
final LineComment n2 = (LineComment) arg;
if (!objEquals(n1.getContent(), n2.getContent())) {
return false;
}
if (!objEquals(n1.getBegin().line, n2.getBegin().line)) {
return false;
}
return true;
}
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:14,代码来源:EqualsVisitor.java
示例11: visit
import com.github.javaparser.ast.comments.LineComment; //导入依赖的package包/类
@Override
public void visit(final LineComment n, final Object arg) {
if (!this.printComments) {
return;
}
printer.print("//");
String tmp = n.getContent();
tmp = tmp.replace('\r', ' ');
tmp = tmp.replace('\n', ' ');
printer.printLn(tmp);
}
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:12,代码来源:DumpVisitor.java
示例12: visit
import com.github.javaparser.ast.comments.LineComment; //导入依赖的package包/类
@Override public void visit(final LineComment n, final Object arg) {
if (!this.printComments) {
return;
}
printer.print("//");
String tmp = n.getContent();
tmp = tmp.replace('\r', ' ');
tmp = tmp.replace('\n', ' ');
printer.printLn(tmp);
}
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:11,代码来源:DumpVisitor.java
示例13: visit
import com.github.javaparser.ast.comments.LineComment; //导入依赖的package包/类
@Override
public void visit(final LineComment n, final Object arg) {
if (!this.printComments) {
return;
}
printer.print("//");
String tmp = n.getContent();
tmp = tmp.replace('\r', ' ');
tmp = tmp.replace('\n', ' ');
printer.println(tmp);
}
开发者ID:WeTheInternet,项目名称:xapi,代码行数:12,代码来源:DumpVisitor.java
示例14: visit
import com.github.javaparser.ast.comments.LineComment; //导入依赖的package包/类
@Override
public Node visit(
LineComment n, Map<Node, Node> arg
) {
if (arg.containsKey(n)) {
return arg.get(n);
}
return super.visit(n, arg);
}
开发者ID:WeTheInternet,项目名称:xapi,代码行数:10,代码来源:ConcreteModifierVisitor.java
示例15: visit
import com.github.javaparser.ast.comments.LineComment; //导入依赖的package包/类
@Override
public void visit(LineComment n, Script arg) {
}
开发者ID:Nosorog,项目名称:nosorog-core,代码行数:4,代码来源:NoOpVisitor.java
示例16: doIsEquals
import com.github.javaparser.ast.comments.LineComment; //导入依赖的package包/类
@Override
public boolean doIsEquals(LineComment first, LineComment second) {
return similarity(first.getContent(),second.getContent()) > 0.9d;
}
开发者ID:beihaifeiwu,项目名称:dolphin,代码行数:5,代码来源:LineCommentMerger.java
示例17: testAddComment
import com.github.javaparser.ast.comments.LineComment; //导入依赖的package包/类
@Test
public void testAddComment(){
unit.addOrphanComment(new LineComment("I am here"));
System.out.println(unit);
}
开发者ID:beihaifeiwu,项目名称:dolphin,代码行数:6,代码来源:JavaparserTest.java
示例18: visit
import com.github.javaparser.ast.comments.LineComment; //导入依赖的package包/类
@Override
public R visit(final LineComment n, final A arg) {
return null;
}
开发者ID:plum-umd,项目名称:java-sketch,代码行数:5,代码来源:GenericVisitorAdapter.java
示例19: visit
import com.github.javaparser.ast.comments.LineComment; //导入依赖的package包/类
@Override
public Node visit(LineComment _n, Object _arg) {
return new LineComment(_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(), _n.getContent());
}
开发者ID:plum-umd,项目名称:java-sketch,代码行数:5,代码来源:CloneVisitor.java
示例20: visit
import com.github.javaparser.ast.comments.LineComment; //导入依赖的package包/类
@Override public void visit(final LineComment n, final A arg) {
visitComment(n.getComment(), arg);
}
开发者ID:plum-umd,项目名称:java-sketch,代码行数:4,代码来源:VoidVisitorAdapter.java
注:本文中的com.github.javaparser.ast.comments.LineComment类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论