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


Java MethodDeclaration.getName方法代码示例

本文整理汇总了Java中japa.parser.ast.body.MethodDeclaration.getName方法的典型用法代码示例。如果您正苦于以下问题:Java MethodDeclaration.getName方法的具体用法?Java MethodDeclaration.getName怎么用?Java MethodDeclaration.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在japa.parser.ast.body.MethodDeclaration的用法示例。


在下文中一共展示了MethodDeclaration.getName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visit

import japa.parser.ast.body.MethodDeclaration; //导入方法依赖的package包/类
@Override
public void visit(MethodDeclaration decl, Object obj) {
    String methodName = decl.getName();
    if (fragment.isOverloaded()) {
        if (!methodCnt.containsKey(methodName))
            methodCnt.put(methodName, 0);
        else
            methodCnt.put(methodName, methodCnt.get(methodName)+1);
        
        methodName += methodCnt.get(methodName);
    }
        
    methods.put(methodName, new Tupel(decl.getBeginLine(), decl.getEndLine()));
}
 
开发者ID:amritbhat786,项目名称:DocIT,代码行数:15,代码来源:JFragmentLocator.java

示例2: createMethod

import japa.parser.ast.body.MethodDeclaration; //导入方法依赖的package包/类
private JavaMethod createMethod (MethodDeclaration method) {
	String className = classStack.peek().getName();
	String name = method.getName();
	boolean isStatic = ModifierSet.hasModifier(method.getModifiers(), ModifierSet.STATIC);
	String returnType = method.getType().toString();
	ArrayList<Argument> arguments = new ArrayList<Argument>();

	if (method.getParameters() != null) {
		for (Parameter parameter : method.getParameters()) {
			arguments.add(new Argument(getArgumentType(parameter), parameter.getId().getName()));
		}
	}

	return new JavaMethod(className, name, isStatic, returnType, null, arguments, method.getBeginLine(), method.getEndLine());
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:16,代码来源:RobustJavaMethodParser.java

示例3: visit

import japa.parser.ast.body.MethodDeclaration; //导入方法依赖的package包/类
@Override
   public void visit(MethodDeclaration n, Object arg) 
{	String prevMethod = currentMethod;
	currentMethod = n.getName();
   	indentLevel++;
	
	if(n.getJavaDoc() != null)
	{	n.getJavaDoc().accept(this, arg);
       }
       if(n.getAnnotations() != null)
       {	for(AnnotationExpr a : n.getAnnotations())
       	{	a.accept(this, arg);
           }
       }
       if(n.getTypeParameters() != null)
       {	for(TypeParameter t : n.getTypeParameters())
       	{	t.accept(this, arg);
           }
       }
       n.getType().accept(this, arg);
       if(n.getParameters() != null)
       {	for (Parameter p : n.getParameters())
       	{	p.accept(this, arg);
           }
       }
       if(n.getThrows() != null)
       {	for(NameExpr name : n.getThrows())
       	{	name.accept(this, arg);
           }
       }
       if(n.getBody() != null)
       {	BlockStmt block = n.getBody();
       	for(int i=0;i<indentLevel;i++)
			System.out.print("..");
       	System.out.println("Analyse de la méthode "+currentMethod);
       	checkBlock(block);  
       	block.accept(this, arg);
       }
       
       currentMethod = prevMethod;
   	indentLevel--;
}
 
开发者ID:vlabatut,项目名称:totalboumboum,代码行数:43,代码来源:AiVisitor.java

示例4: visit

import japa.parser.ast.body.MethodDeclaration; //导入方法依赖的package包/类
@Override
    public void visit(MethodDeclaration n, Object arg) 
	{	String prevMethod = currentMethod;
		currentMethod = n.getName();
    	indentLevel++;
		
		if(n.getJavaDoc() != null)
		{	n.getJavaDoc().accept(this, arg);
        }
        if(n.getAnnotations() != null)
        {	for(AnnotationExpr a : n.getAnnotations())
        	{	a.accept(this, arg);
            }
        }
        if(n.getTypeParameters() != null)
        {	for(TypeParameter t : n.getTypeParameters())
        	{	t.accept(this, arg);
            }
        }
        n.getType().accept(this, arg);
        if(n.getParameters() != null)
        {	for (Parameter p : n.getParameters())
        	{	p.accept(this, arg);
            }
        }
        if(n.getThrows() != null)
        {	for(NameExpr name : n.getThrows())
        	{	name.accept(this, arg);
            }
        }
        if(n.getBody() != null)
        {	BlockStmt block = n.getBody();
//if(name.equals("getZoneArray"))
//	System.out.println();
        	for(int i=0;i<indentLevel;i++)
				System.out.print("..");
        	System.out.println("Analyse de la méthode "+currentMethod);
        	checkBlock(block);  
        	block.accept(this, arg);
        }
        
        currentMethod = prevMethod;
    	indentLevel--;
  }
 
开发者ID:vlabatut,项目名称:totalboumboum,代码行数:45,代码来源:AiVisitor.java

示例5: visit

import japa.parser.ast.body.MethodDeclaration; //导入方法依赖的package包/类
@Override
   public void visit(MethodDeclaration n, Object arg) 
{	String prevMethod = currentMethod;
	currentMethod = n.getName();
   	indentLevel++;
	
	if(n.getJavaDoc() != null)
	{	n.getJavaDoc().accept(this, arg);
       }
       if(n.getAnnotations() != null)
       {	for(AnnotationExpr a : n.getAnnotations())
       	{	a.accept(this, arg);
           }
       }
       if(n.getTypeParameters() != null)
       {	for(TypeParameter t : n.getTypeParameters())
       	{	t.accept(this, arg);
           }
       }
       n.getType().accept(this, arg);
       if(n.getParameters() != null)
       {	for (Parameter p : n.getParameters())
       	{	p.accept(this, arg);
           }
       }
       if(n.getThrows() != null)
       {	for(NameExpr name : n.getThrows())
       	{	name.accept(this, arg);
           }
       }
       if(n.getBody() != null)
       {	BlockStmt block = n.getBody();
       	for(int i=0;i<indentLevel;i++)
			System.out.print("..");
       	System.out.println("Analyse de la méthode "+currentMethod);
       	checkBlock(block);  
       	block.accept(this, arg);
       }
       
       currentMethod = prevMethod;
   	indentLevel--;
 }
 
开发者ID:vlabatut,项目名称:totalboumboum,代码行数:43,代码来源:AiVisitor.java

示例6: visit

import japa.parser.ast.body.MethodDeclaration; //导入方法依赖的package包/类
@Override
public MethodDeclaration visit(MethodDeclaration n, Void arg) {
    if (!n.isGenerator()) {
        throw new UnsupportedOperationException("cannot transform non-generator");
    }

    // Desugar ALL the loops!
    n.accept(new LoopDesugarTransform(), null);
    if (CompilerSettings.dumpDesugar) {
        System.err.println(n);
    }

    Generator g = new Generator();
    Map<String, TypedVariableDeclarator> vars = new HashMap<String, TypedVariableDeclarator>();

    // Mangle all our scope variables.
    n.accept(new ScopeMangleTransform(), vars);
    if (CompilerSettings.dumpMangle) {
        System.err.println(n);
    }

    // Generate the body.
    n.accept(new LinearizeTransform(), g);

    List<BodyDeclaration> generatorBody = new ArrayList<BodyDeclaration>();

    // Add the fields to the generator body.
    for (Map.Entry<String, TypedVariableDeclarator> kv : vars.entrySet()) {
        VariableDeclarator decl = new VariableDeclarator(new VariableDeclaratorId(kv.getKey()), null);
        generatorBody.add(new FieldDeclaration(ModifierSet.PRIVATE, kv.getValue().type, decl));
    }

    // Add the moveNext method to the generator body.
    generatorBody.add(new MethodDeclaration(0, 0, 0, 0, null, ModifierSet.PROTECTED,
                                            null, null, new PrimitiveType(Primitive.Boolean),
                                            "moveNext", null, 0, null, false,
                                            new BlockStmt(g.generate())));

    ObjectCreationExpr o = new ObjectCreationExpr(0, 0, 0, 0, null, makeRtGeneratorType(n.getType()), null, null, generatorBody);
    List<Statement> methodBody = new ArrayList<Statement>();
    methodBody.add(new ReturnStmt(o));
    MethodDeclaration n2 = new MethodDeclaration(n.getBeginLine(),
            n.getBeginColumn(),
            n.getEndLine(),
            n.getEndColumn(),
            n.getJavaDoc(),
            n.getModifiers(),
            n.getAnnotations(),
            n.getTypeParameters(),
            makeRtGeneratorType(n.getType()),
            n.getName(),
            n.getParameters(),
            n.getArrayCount(),
            n.getThrows(),
            false,
            new BlockStmt(methodBody));

    return n2;
}
 
开发者ID:rfw,项目名称:genja,代码行数:60,代码来源:GeneratorTransform.java


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