当前位置: 首页>>代码示例>>Java>>正文


Java ExplicitConstructorInvocationStmt类代码示例

本文整理汇总了Java中com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt的典型用法代码示例。如果您正苦于以下问题:Java ExplicitConstructorInvocationStmt类的具体用法?Java ExplicitConstructorInvocationStmt怎么用?Java ExplicitConstructorInvocationStmt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ExplicitConstructorInvocationStmt类属于com.github.javaparser.ast.stmt包,在下文中一共展示了ExplicitConstructorInvocationStmt类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visit

import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
@Override
public void visit(final ExplicitConstructorInvocationStmt n, final Object arg) {
    printer.printLn("ExplicitConstructorInvocationStmt");
    printJavaComment(n.getComment(), arg);
    if (n.isThis()) {
        printTypeArgs(n.getTypeArgs(), arg);
        printer.print("this");
    } else {
        if (n.getExpr() != null) {
            n.getExpr().accept(this, arg);
            printer.print(".");
        }
        printTypeArgs(n.getTypeArgs(), arg);
        printer.print("super");
    }
    printArguments(n.getArgs(), arg);
    printer.print(";");
}
 
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:19,代码来源:ASTDumpVisitor.java

示例2: visit

import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
@Override public Boolean visit(final ExplicitConstructorInvocationStmt n1, final Node arg) {
	final ExplicitConstructorInvocationStmt n2 = (ExplicitConstructorInvocationStmt) arg;

	if (!nodeEquals(n1.getExpr(), n2.getExpr())) {
		return Boolean.FALSE;
	}

	if (!nodesEquals(n1.getArgs(), n2.getArgs())) {
		return Boolean.FALSE;
	}

	if (!nodesEquals(n1.getTypeArgs(), n2.getTypeArgs())) {
		return Boolean.FALSE;
	}

	return Boolean.TRUE;
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:18,代码来源:EqualsVisitor.java

示例3: visit

import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
@Override public void visit(final ExplicitConstructorInvocationStmt n, final Object arg) {
printJavaComment(n.getComment(), arg);
if (n.isThis()) {
    printTypeArgs(n.getTypeArgs(), arg);
    printer.print("this");
} else {
    if (n.getExpr() != null) {
	n.getExpr().accept(this, arg);
	printer.print(".");
    }
    printTypeArgs(n.getTypeArgs(), arg);
    printer.print("super");
}
printArguments(n.getArgs(), arg);
printer.print(";");
   }
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:17,代码来源:DumpVisitor.java

示例4: visit

import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
@Override public void visit(final ExplicitConstructorInvocationStmt n, final A arg) {
	visitComment(n.getComment(), arg);
	if (!n.isThis()) {
		if (n.getExpr() != null) {
			n.getExpr().accept(this, arg);
		}
	}
	if (n.getTypeArgs() != null) {
		for (final Type t : n.getTypeArgs()) {
			t.accept(this, arg);
		}
	}
	if (n.getArgs() != null) {
		for (final Expression e : n.getArgs()) {
			e.accept(this, arg);
		}
	}
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:19,代码来源:VoidVisitorAdapter.java

示例5: visit

import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
@Override public void visit(final ExplicitConstructorInvocationStmt n, final A arg) {
    jw.write(n); 
    visitComment(n.getComment(), arg);
    if (!n.isThis()) {
        if (n.getExpr() != null) {
            n.getExpr().accept(this, arg);
        }
    }
    if (n.getTypeArgs() != null) {
        for (final Type t : n.getTypeArgs()) {
            t.accept(this, arg);
        }
    }
    if (n.getArgs() != null) {
        for (final Expression e : n.getArgs()) {
            e.accept(this, arg);
        }
    }
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:20,代码来源:JsonVisitorAdapter.java

示例6: visit

import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
@Override public Node visit(final ExplicitConstructorInvocationStmt n, final A arg) {
	if (!n.isThis()) {
		if (n.getExpr() != null) {
			n.setExpr((Expression) n.getExpr().accept(this, arg));
		}
	}
	final List<Type> typeArgs = n.getTypeArgs();
	if (typeArgs != null) {
		for (int i = 0; i < typeArgs.size(); i++) {
			typeArgs.set(i, (Type) typeArgs.get(i).accept(this, arg));
		}
		removeNulls(typeArgs);
	}
	final List<Expression> args = n.getArgs();
	if (args != null) {
		for (int i = 0; i < args.size(); i++) {
			args.set(i, (Expression) args.get(i).accept(this, arg));
		}
		removeNulls(args);
	}
	return n;
}
 
开发者ID:plum-umd,项目名称:java-sketch,代码行数:23,代码来源:ModifierVisitorAdapter.java

示例7: visit

import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
@Override public Boolean visit(final ExplicitConstructorInvocationStmt n1, final Node arg) {
	final ExplicitConstructorInvocationStmt n2 = (ExplicitConstructorInvocationStmt) arg;

	if (!nodeEquals(n1.getExpr(), n2.getExpr())) {
		return false;
	}

	if (!nodesEquals(n1.getArgs(), n2.getArgs())) {
		return false;
	}

	if (!nodesEquals(n1.getTypeArguments(), n2.getTypeArguments())) {
		return false;
	}

	return true;
}
 
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:18,代码来源:EqualsVisitor.java

示例8: visit

import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
@Override
public Node visit(ExplicitConstructorInvocationStmt _n, Object _arg) {
	List<Type<?>> typeArguments_ = visit(_n.getTypeArguments(), _arg);
	Expression expr_ = cloneNodes(_n.getExpr(), _arg);
	List<Expression> args_ = visit(_n.getArgs(), _arg);
	Comment comment = cloneNodes(_n.getComment(), _arg);

	ExplicitConstructorInvocationStmt r = new ExplicitConstructorInvocationStmt(
			_n.getRange(),
			typeArguments_, 
               _n.isThis(), 
               expr_, 
               args_
	);
	r.setComment(comment);
	return r;
}
 
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:18,代码来源:CloneVisitor.java

示例9: visit

import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
@Override public Node visit(final ExplicitConstructorInvocationStmt n, final A arg) {
	visitComment(n, arg);
	if (!n.isThis() && n.getExpr() != null) {
		n.setExpr((Expression) n.getExpr().accept(this, arg));
	}
       final List<Type<?>> typeArguments = n.getTypeArguments();
       if (typeArguments != null) {
           for (int i = 0; i < typeArguments.size(); i++) {
               typeArguments.set(i, (Type<?>) typeArguments.get(i).accept(this, arg));
           }
           removeNulls(typeArguments);
       }
	final List<Expression> args = n.getArgs();
	if (args != null) {
		for (int i = 0; i < args.size(); i++) {
			args.set(i, (Expression) args.get(i).accept(this, arg));
		}
		removeNulls(args);
	}
	return n;
}
 
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:22,代码来源:ModifierVisitorAdapter.java

示例10: visit

import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
@Override public void visit(final ExplicitConstructorInvocationStmt n, final Object arg) {
	printJavaComment(n.getComment(), arg);
	if (n.isThis()) {
		printTypeArgs(n.getTypeArgs(), arg);
		printer.print("this");
	} else {
		if (n.getExpr() != null) {
			n.getExpr().accept(this, arg);
			printer.print(".");
		}
		printTypeArgs(n.getTypeArgs(), arg);
		printer.print("super");
	}
	printArguments(n.getArgs(), arg);
	printer.print(";");
}
 
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:17,代码来源:DumpVisitor.java

示例11: visit

import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
@Override
public JCTree visit(final ExplicitConstructorInvocationStmt n, final Object arg) {
    //ARG0: List<JCExpression> typeargs
    List<JCExpression> arg0 = List.<JCExpression>nil();
    if (n.getTypeArgs() != null) {
        for (final com.github.javaparser.ast.type.Type t : n.getTypeArgs()) {
            arg0 = arg0.append((JCExpression) t.accept(this, arg));
        }
    }

    //ARG1: JCExpression fn
    JCExpression arg1;
    if (n.isThis()) {
        arg1 = new AJCIdent(make.Ident(names.fromString("this")), null);
    } else {
        if (n.getExpr() != null) {
            arg1 = new AJCFieldAccess(make.Select((JCExpression) n.getExpr().accept(this, arg), names.fromString("super")), null);
        } else {
            arg1 = new AJCIdent(make.Ident(names.fromString("super")), null);
        }
    }

    //ARG2: List<JCExpression> args
    List<JCExpression> arg2 = List.<JCExpression>nil();
    if (n.getArgs() != null) {
        for (final Expression e : n.getArgs()) {
            arg2 = arg2.append((JCExpression) e.accept(this, arg));
        }
    }

    // It is expected a Statement, so converting the invocation

    return new AJCExpressionStatement(make.Exec(new AJCMethodInvocation(make.Apply(arg0, arg1, arg2), null)), ((n.getComment() != null) ? n.getComment().getContent() : null));
}
 
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:35,代码来源:JavaParser2JCTree.java

示例12: doMerge

import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
@Override public ExplicitConstructorInvocationStmt doMerge(ExplicitConstructorInvocationStmt first, ExplicitConstructorInvocationStmt second) {
  ExplicitConstructorInvocationStmt ecis = new ExplicitConstructorInvocationStmt();
  ecis.setArgs(mergeCollectionsInOrder(first.getArgs(),second.getArgs()));
  ecis.setTypeArgs(mergeCollectionsInOrder(first.getTypeArgs(),second.getTypeArgs()));
  ecis.setExpr(mergeSingle(first.getExpr(),second.getExpr()));
  ecis.setThis(first.isThis());
  return ecis;
}
 
开发者ID:beihaifeiwu,项目名称:dolphin,代码行数:9,代码来源:ExplicitConstructorInvocationStmtMerger.java

示例13: doIsEquals

import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
@Override public boolean doIsEquals(ExplicitConstructorInvocationStmt first, ExplicitConstructorInvocationStmt second) {

    if(!isEqualsUseMerger(first.getExpr(),second.getExpr())) return false;
    if(!isEqualsUseMerger(first.getTypeArgs(),second.getTypeArgs())) return false;
    if(!isEqualsUseMerger(first.getArgs(),second.getArgs())) return false;
    if(first.isThis() != second.isThis()) return false;

    return true;
  }
 
开发者ID:beihaifeiwu,项目名称:dolphin,代码行数:10,代码来源:ExplicitConstructorInvocationStmtMerger.java

示例14: solve

import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
public SymbolReference<ConstructorDeclaration> solve(ExplicitConstructorInvocationStmt explicitConstructorInvocationStmt, boolean solveLambdas) {
    List<Type> argumentTypes = new LinkedList<>();
    List<LambdaArgumentTypePlaceholder> placeholders = new LinkedList<>();

    solveArguments(explicitConstructorInvocationStmt, explicitConstructorInvocationStmt.getArguments(), solveLambdas, argumentTypes, placeholders);

    Optional<ClassOrInterfaceDeclaration> optAncestor = explicitConstructorInvocationStmt.getAncestorOfType(ClassOrInterfaceDeclaration.class);
    if (!optAncestor.isPresent()) {
        return SymbolReference.unsolved(ConstructorDeclaration.class);
    }
    ClassOrInterfaceDeclaration classNode = optAncestor.get();
    TypeDeclaration typeDecl = null;
    if (!explicitConstructorInvocationStmt.isThis()) {
        Type classDecl = JavaParserFacade.get(typeSolver).convert(classNode.getExtendedTypes(0), classNode);
        if (classDecl.isReferenceType()) {
            typeDecl = classDecl.asReferenceType().getTypeDeclaration();
        }
    } else {
        SymbolReference<TypeDeclaration> sr = JavaParserFactory.getContext(classNode, typeSolver).solveType(classNode.getNameAsString(), typeSolver);
        if (sr.isSolved()) {
            typeDecl = sr.getCorrespondingDeclaration();
        }
    }
    if (typeDecl == null) {
        return SymbolReference.unsolved(ConstructorDeclaration.class);
    }
    SymbolReference<ConstructorDeclaration> res = ConstructorResolutionLogic.findMostApplicable(((ClassDeclaration) typeDecl).getConstructors(), argumentTypes, typeSolver);
    for (LambdaArgumentTypePlaceholder placeholder : placeholders) {
        placeholder.setMethod(res);
    }
    return res;
}
 
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:33,代码来源:JavaParserFacade.java

示例15: solve

import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; //导入依赖的package包/类
public SymbolReference<ResolvedConstructorDeclaration> solve(ExplicitConstructorInvocationStmt explicitConstructorInvocationStmt, boolean solveLambdas) {
    List<ResolvedType> argumentTypes = new LinkedList<>();
    List<LambdaArgumentTypePlaceholder> placeholders = new LinkedList<>();

    solveArguments(explicitConstructorInvocationStmt, explicitConstructorInvocationStmt.getArguments(), solveLambdas, argumentTypes, placeholders);

    Optional<ClassOrInterfaceDeclaration> optAncestor = explicitConstructorInvocationStmt.getAncestorOfType(ClassOrInterfaceDeclaration.class);
    if (!optAncestor.isPresent()) {
        return SymbolReference.unsolved(ResolvedConstructorDeclaration.class);
    }
    ClassOrInterfaceDeclaration classNode = optAncestor.get();
    ResolvedTypeDeclaration typeDecl = null;
    if (!explicitConstructorInvocationStmt.isThis()) {
        ResolvedType classDecl = JavaParserFacade.get(typeSolver).convert(classNode.getExtendedTypes(0), classNode);
        if (classDecl.isReferenceType()) {
            typeDecl = classDecl.asReferenceType().getTypeDeclaration();
        }
    } else {
        SymbolReference<ResolvedTypeDeclaration> sr = JavaParserFactory.getContext(classNode, typeSolver).solveType(classNode.getNameAsString(), typeSolver);
        if (sr.isSolved()) {
            typeDecl = sr.getCorrespondingDeclaration();
        }
    }
    if (typeDecl == null) {
        return SymbolReference.unsolved(ResolvedConstructorDeclaration.class);
    }
    SymbolReference<ResolvedConstructorDeclaration> res = ConstructorResolutionLogic.findMostApplicable(((ResolvedClassDeclaration) typeDecl).getConstructors(), argumentTypes, typeSolver);
    for (LambdaArgumentTypePlaceholder placeholder : placeholders) {
        placeholder.setMethod(res);
    }
    return res;
}
 
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:33,代码来源:JavaParserFacade.java


注:本文中的com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。