本文整理汇总了Java中com.github.javaparser.ast.comments.LineComment类的典型用法代码示例。如果您正苦于以下问题:Java LineComment类的具体用法?Java LineComment怎么用?Java LineComment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LineComment类属于com.github.javaparser.ast.comments包,在下文中一共展示了LineComment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例15: visit
import com.github.javaparser.ast.comments.LineComment; //导入依赖的package包/类
@Override
public void visit(LineComment n, Script arg) {
}