Search in sources :

Example 1 with Visitable

use of com.github.javaparser.ast.visitor.Visitable in project Matcher by sfPlayer1.

the class HtmlPrinter method printPrePostFixRequiredList.

private void printPrePostFixRequiredList(final NodeList<? extends Visitable> args, final Void arg, String prefix, String separator, String postfix) {
    printer.print(prefix);
    if (!args.isEmpty()) {
        for (final Iterator<? extends Visitable> i = args.iterator(); i.hasNext(); ) {
            final Visitable v = i.next();
            v.accept(this, arg);
            if (i.hasNext()) {
                printer.print(separator);
            }
        }
    }
    printer.print(postfix);
}
Also used : Visitable(com.github.javaparser.ast.visitor.Visitable)

Example 2 with Visitable

use of com.github.javaparser.ast.visitor.Visitable in project gin by gintool.

the class CloneVisitorCopyIDs method visit.

@Override
public Visitable visit(final ClassExpr n, final Object arg) {
    Visitable r = checkForReplacement(n);
    if (r == null) {
        r = super.visit(n, arg);
        ((ClassExpr) r).setData(SourceFileTree.NODEKEY_ID, n.containsData(SourceFileTree.NODEKEY_ID) ? n.getData(SourceFileTree.NODEKEY_ID) : SourceFileTree.NODE_NULL_ID);
    }
    return r;
}
Also used : Visitable(com.github.javaparser.ast.visitor.Visitable) ClassExpr(com.github.javaparser.ast.expr.ClassExpr)

Example 3 with Visitable

use of com.github.javaparser.ast.visitor.Visitable in project gin by gintool.

the class CloneVisitorCopyIDs method visit.

@Override
public Visitable visit(final UnknownType n, final Object arg) {
    Visitable r = checkForReplacement(n);
    if (r == null) {
        r = super.visit(n, arg);
        ((UnknownType) r).setData(SourceFileTree.NODEKEY_ID, n.containsData(SourceFileTree.NODEKEY_ID) ? n.getData(SourceFileTree.NODEKEY_ID) : SourceFileTree.NODE_NULL_ID);
    }
    return r;
}
Also used : UnknownType(com.github.javaparser.ast.type.UnknownType) Visitable(com.github.javaparser.ast.visitor.Visitable)

Example 4 with Visitable

use of com.github.javaparser.ast.visitor.Visitable in project gin by gintool.

the class CloneVisitorCopyIDs method visit.

@Override
public Visitable visit(final MemberValuePair n, final Object arg) {
    Visitable r = checkForReplacement(n);
    if (r == null) {
        r = super.visit(n, arg);
        ((MemberValuePair) r).setData(SourceFileTree.NODEKEY_ID, n.containsData(SourceFileTree.NODEKEY_ID) ? n.getData(SourceFileTree.NODEKEY_ID) : SourceFileTree.NODE_NULL_ID);
    }
    return r;
}
Also used : MemberValuePair(com.github.javaparser.ast.expr.MemberValuePair) Visitable(com.github.javaparser.ast.visitor.Visitable)

Example 5 with Visitable

use of com.github.javaparser.ast.visitor.Visitable in project gin by gintool.

the class CloneVisitorCopyIDs method visit.

@Override
public Visitable visit(final ArrayInitializerExpr n, final Object arg) {
    Visitable r = checkForReplacement(n);
    if (r == null) {
        r = super.visit(n, arg);
        ((ArrayInitializerExpr) r).setData(SourceFileTree.NODEKEY_ID, n.containsData(SourceFileTree.NODEKEY_ID) ? n.getData(SourceFileTree.NODEKEY_ID) : SourceFileTree.NODE_NULL_ID);
    }
    return r;
}
Also used : ArrayInitializerExpr(com.github.javaparser.ast.expr.ArrayInitializerExpr) Visitable(com.github.javaparser.ast.visitor.Visitable)

Aggregations

Visitable (com.github.javaparser.ast.visitor.Visitable)102 Node (com.github.javaparser.ast.Node)2 ReceiverParameter (com.github.javaparser.ast.body.ReceiverParameter)2 SimpleName (com.github.javaparser.ast.expr.SimpleName)2 TypeParameter (com.github.javaparser.ast.type.TypeParameter)2 ArrayCreationLevel (com.github.javaparser.ast.ArrayCreationLevel)1 CompilationUnit (com.github.javaparser.ast.CompilationUnit)1 Modifier (com.github.javaparser.ast.Modifier)1 PackageDeclaration (com.github.javaparser.ast.PackageDeclaration)1 AnnotationDeclaration (com.github.javaparser.ast.body.AnnotationDeclaration)1 AnnotationMemberDeclaration (com.github.javaparser.ast.body.AnnotationMemberDeclaration)1 ClassOrInterfaceDeclaration (com.github.javaparser.ast.body.ClassOrInterfaceDeclaration)1 ConstructorDeclaration (com.github.javaparser.ast.body.ConstructorDeclaration)1 EnumConstantDeclaration (com.github.javaparser.ast.body.EnumConstantDeclaration)1 EnumDeclaration (com.github.javaparser.ast.body.EnumDeclaration)1 FieldDeclaration (com.github.javaparser.ast.body.FieldDeclaration)1 InitializerDeclaration (com.github.javaparser.ast.body.InitializerDeclaration)1 MethodDeclaration (com.github.javaparser.ast.body.MethodDeclaration)1 Parameter (com.github.javaparser.ast.body.Parameter)1 VariableDeclarator (com.github.javaparser.ast.body.VariableDeclarator)1