• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java BlockStmt类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: visit

import japa.parser.ast.stmt.BlockStmt; //导入依赖的package包/类
@Override
public Boolean visit(BlockStmt n, Void arg) {
    boolean needsProcessing = false;

    if (n.getStmts() != null) {
        for (Statement s : n.getStmts()) {
            needsProcessing = s.accept(this, arg) || needsProcessing;
        }
    }
    if (needsProcessing) {
        NodeAnnotation nodeAnnotation = new NodeAnnotation(true);
        n.setData(nodeAnnotation);
    }
    return needsProcessing;

}
 
开发者ID:rfw,项目名称:genja,代码行数:17,代码来源:NodeAnnotator.java


示例2: findRootAssignExpr

import japa.parser.ast.stmt.BlockStmt; //导入依赖的package包/类
private static AssignExpr findRootAssignExpr(BlockStmt body) {
    if (body.getStmts() != null) {
        for (Statement s : body.getStmts()) {
            if (s instanceof ExpressionStmt) {
                ExpressionStmt est = (ExpressionStmt) s;
                if (est.getExpression() instanceof AssignExpr) {
                    AssignExpr ass = (AssignExpr) est.getExpression();
                    if (ass.getTarget() instanceof FieldAccessExpr) {
                        FieldAccessExpr fae = (FieldAccessExpr) ass.getTarget();
                        if ("root".equals(fae.getField())) {
                            return ass;
                        }
                    }
                }
            }
        }
    }
    return null;
}
 
开发者ID:ahn,项目名称:mideaas,代码行数:20,代码来源:JavaUtil.java


示例3: addAttachSkeleton

import japa.parser.ast.stmt.BlockStmt; //导入依赖的package包/类
private void addAttachSkeleton() {
	List<Parameter> params = Collections.emptyList();
	MethodDeclaration method = new MethodDeclaration(
			ModifierSet.PUBLIC, new VoidType(), "attach", params);
	AnnotationExpr override = new MarkerAnnotationExpr(new NameExpr("Override"));
	method.setAnnotations(Collections.singletonList(override));
	
	BlockStmt block = new BlockStmt();
	Expression e = new MethodCallExpr(new SuperExpr(), "attach");
	List<Statement> sts = Collections.singletonList((Statement)new ExpressionStmt(e));
	block.setStmts(sts);
	method.setBody(block);
	
	if (getType().getMembers()==null) {
		getType().setMembers(new LinkedList<BodyDeclaration>());
	}
	getType().getMembers().add(method);
}
 
开发者ID:ahn,项目名称:mideaas,代码行数:19,代码来源:ControllerCode.java


示例4: addOnBecomingVisibleMethod

import japa.parser.ast.stmt.BlockStmt; //导入依赖的package包/类
@SuppressWarnings("unused")
private void addOnBecomingVisibleMethod() {
	List<Parameter> params = Collections.emptyList();
	MethodDeclaration method = new MethodDeclaration(
			ModifierSet.PUBLIC, new VoidType(), "onBecomingVisible", params);
	AnnotationExpr override = new MarkerAnnotationExpr(new NameExpr("Override"));
	method.setAnnotations(Collections.singletonList(override));
	
	BlockStmt block = new BlockStmt();
	Expression e = new MethodCallExpr(new SuperExpr(), "onBecomingVisible");
	List<Statement> sts = Collections.singletonList((Statement)new ExpressionStmt(e));
	block.setStmts(sts);
	method.setBody(block);
	
	if (getType().getMembers()==null) {
		getType().setMembers(new LinkedList<BodyDeclaration>());
	}
	getType().getMembers().add(method);
}
 
开发者ID:ahn,项目名称:mideaas,代码行数:20,代码来源:ControllerCode.java


示例5: addClaraHandler

import japa.parser.ast.stmt.BlockStmt; //导入依赖的package包/类
private MethodDeclaration addClaraHandler(String id, String className) {
	ensureImport(className);
	String shortName = className.substring(className.lastIndexOf(".")+1);
	String handlerName = generateHandlerNameFor(id, shortName);
	
	Parameter p = new Parameter(new ClassOrInterfaceType(shortName), new VariableDeclaratorId("event"));
	MethodDeclaration handler = new MethodDeclaration(
			ModifierSet.PUBLIC, new VoidType(), handlerName, Collections.singletonList(p));
	handler.setBody(new BlockStmt());
	handler.setAnnotations(createClaraHandlerAnnotations(id));
	
	addNotification(handler, shortName+" on "+id);		
	
	addMember(handler);
	return handler;
}
 
开发者ID:ahn,项目名称:mideaas,代码行数:17,代码来源:ControllerCode.java


示例6: visit

import japa.parser.ast.stmt.BlockStmt; //导入依赖的package包/类
@Override
  public void visit(ConstructorDeclaration 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);
          }
      }
      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);
          }
      }
      BlockStmt block = n.getBlock();
      for(int i=0;i<indentLevel;i++)
	System.out.print("..");
System.out.println("Analyse du constructeur "+currentMethod);
  	if(checkConstructor)
  		checkBlock(block);
      block.accept(this, arg);
      
      currentMethod = prevMethod;
  	indentLevel--;
 }
 
开发者ID:vlabatut,项目名称:totalboumboum,代码行数:41,代码来源:AiVisitor.java


示例7: buildUnit

import japa.parser.ast.stmt.BlockStmt; //导入依赖的package包/类
public static void buildUnit() {
    CompilationUnit compUnit = new CompilationUnit();
    
    compUnit.setPackage(new PackageDeclaration(ASTHelper
                                               .createNameExpr("compiladores.aula")));
    
    // create the type declaration
    ClassOrInterfaceDeclaration type = new ClassOrInterfaceDeclaration(
                                                                       ModifierSet.PUBLIC, false, "AulaJavaParser");
    ASTHelper.addTypeDeclaration(compUnit, type);
    
    // create a method
    MethodDeclaration method = new MethodDeclaration(ModifierSet.PUBLIC,
                                                     ASTHelper.VOID_TYPE, "main");
    method.setModifiers(ModifierSet.addModifier(method.getModifiers(),
                                                ModifierSet.STATIC));
    ASTHelper.addMember(type, method);
    
    // add a parameter to the method
    Parameter param = ASTHelper.createParameter(
                                                ASTHelper.createReferenceType("String", 0), "args");
    param.setVarArgs(true); //makes the parameter a ",,," array
    ASTHelper.addParameter(method, param);
    
    // add a body to the method
    BlockStmt block = new BlockStmt();
    method.setBody(block);
    
    // add a statement do the method body
    NameExpr clazz = new NameExpr("System");
    FieldAccessExpr field = new FieldAccessExpr(clazz, "out");
    MethodCallExpr call = new MethodCallExpr(field, "println");
    ASTHelper.addArgument(call, new StringLiteralExpr("Hello World!"));
    ASTHelper.addStmt(block, call);
    
    System.out.println(compUnit.toString());
}
 
开发者ID:damorim,项目名称:compilers-cin,代码行数:38,代码来源:ParserExample.java


示例8: visit

import japa.parser.ast.stmt.BlockStmt; //导入依赖的package包/类
@Override
public void visit(BlockStmt n, Generator s) {
    if (n.getStmts() == null) return;

    // Either add statements from the block into the transformer state, or process them because
    // we have yields in them.
    for (Statement stmt : n.getStmts()) {
        if (stmt.getData() instanceof NodeAnnotation && ((NodeAnnotation) stmt.getData()).needsProcessing) {
            stmt.accept(this, s);
        } else {
            s.addStatement(stmt);
        }
    }

}
 
开发者ID:rfw,项目名称:genja,代码行数:16,代码来源:LinearizeTransform.java


示例9: visit

import japa.parser.ast.stmt.BlockStmt; //导入依赖的package包/类
@Override
public Node visit(DoStmt n, Void arg) {
    super.visit(n, arg);

    // Reword the loop.
    List<Statement> stmts = new ArrayList<Statement>();
    stmts.add(n.getBody());
    stmts.add(makeLoopCondition(n.getCondition()));
    BlockStmt b = new BlockStmt(stmts);
    return makeLoopStmt(b);
}
 
开发者ID:rfw,项目名称:genja,代码行数:12,代码来源:LoopDesugarTransform.java


示例10: generateJump

import japa.parser.ast.stmt.BlockStmt; //导入依赖的package包/类
/**
 * Generate an immediate jump.
 */
public static Statement generateJump(int state) {
    List<Statement> stmts = new ArrayList<Statement>();
    stmts.add(generateDeferredJump(state));
    stmts.add(new BreakStmt(null));
    return new BlockStmt(stmts);
}
 
开发者ID:rfw,项目名称:genja,代码行数:10,代码来源:Generator.java


示例11: visit

import japa.parser.ast.stmt.BlockStmt; //导入依赖的package包/类
@Override
public Node visit(BlockStmt n, Map<String, TypedVariableDeclarator> arg) {
    this.enter();
    Node r = super.visit(n, arg);
    this.exit();
    return r;
}
 
开发者ID:rfw,项目名称:genja,代码行数:8,代码来源:ScopeMangleTransform.java


示例12: visit

import japa.parser.ast.stmt.BlockStmt; //导入依赖的package包/类
@Override
public void visit(BlockStmt n, Scope arg) {
    Scope subScope = new Scope(Scope.Type.BLOCK);
    subScope.backs.add(arg);
    super.visit(n, subScope);
    n.setData(arg);
}
 
开发者ID:rfw,项目名称:genja,代码行数:8,代码来源:ScopeCollector.java


示例13: ConstructorDeclaration

import japa.parser.ast.stmt.BlockStmt; //导入依赖的package包/类
public ConstructorDeclaration(JavadocComment javaDoc, int modifiers, List<AnnotationExpr> annotations, List<TypeParameter> typeParameters, String name, List<Parameter> parameters, List<NameExpr> throws_, BlockStmt block) {
    super(annotations, javaDoc);
    this.modifiers = modifiers;
    this.typeParameters = typeParameters;
    this.name = name;
    this.parameters = parameters;
    this.throws_ = throws_;
    this.block = block;
}
 
开发者ID:rfw,项目名称:genja,代码行数:10,代码来源:ConstructorDeclaration.java


示例14: MethodDeclaration

import japa.parser.ast.stmt.BlockStmt; //导入依赖的package包/类
public MethodDeclaration(JavadocComment javaDoc, int modifiers, List<AnnotationExpr> annotations, List<TypeParameter> typeParameters, Type type, String name, List<Parameter> parameters, int arrayCount, List<NameExpr> throws_, boolean generator, BlockStmt block) {
    super(annotations, javaDoc);
    this.modifiers = modifiers;
    this.typeParameters = typeParameters;
    this.type = type;
    this.name = name;
    this.parameters = parameters;
    this.arrayCount = arrayCount;
    this.throws_ = throws_;
    this.generator = generator;
    this.body = block;
}
 
开发者ID:rfw,项目名称:genja,代码行数:13,代码来源:MethodDeclaration.java


示例15: visit

import japa.parser.ast.stmt.BlockStmt; //导入依赖的package包/类
public R visit(BlockStmt n, A arg) {
    if (n.getStmts() != null) {
        for (Statement s : n.getStmts()) {
            s.accept(this, arg);
        }
    }
    return null;

}
 
开发者ID:rfw,项目名称:genja,代码行数:10,代码来源:GenericVisitorAdapter.java


示例16: visit

import japa.parser.ast.stmt.BlockStmt; //导入依赖的package包/类
public Boolean visit(BlockStmt n1, Node arg) {
    BlockStmt n2 = (BlockStmt) arg;

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

    return Boolean.TRUE;
}
 
开发者ID:rfw,项目名称:genja,代码行数:10,代码来源:EqualsVisitor.java


示例17: visit

import japa.parser.ast.stmt.BlockStmt; //导入依赖的package包/类
public void visit(BlockStmt n, Object arg) {
    printer.printLn("{");
    if (n.getStmts() != null) {
        printer.indent();
        for (Statement s : n.getStmts()) {
            s.accept(this, arg);
            printer.printLn();
        }
        printer.unindent();
    }
    printer.print("}");

}
 
开发者ID:rfw,项目名称:genja,代码行数:14,代码来源:DumpVisitor.java


示例18: visit

import japa.parser.ast.stmt.BlockStmt; //导入依赖的package包/类
public void visit(BlockStmt n, A arg) {
    if (n.getStmts() != null) {
        for (Statement s : n.getStmts()) {
            s.accept(this, arg);
        }
    }
}
 
开发者ID:rfw,项目名称:genja,代码行数:8,代码来源:VoidVisitorAdapter.java


示例19: visit

import japa.parser.ast.stmt.BlockStmt; //导入依赖的package包/类
public Node visit(BlockStmt n, A arg) {
    List<Statement> stmts = n.getStmts();
    if (stmts != null) {
        for (int i = 0; i < stmts.size(); i++) {
            stmts.set(i, (Statement) stmts.get(i).accept(this, arg));
        }
        removeNulls(stmts);
    }
    return n;
}
 
开发者ID:rfw,项目名称:genja,代码行数:11,代码来源:ModifierVisitorAdapter.java


示例20: addStmt

import japa.parser.ast.stmt.BlockStmt; //导入依赖的package包/类
/**
 * Adds the given statement to the specified block. The list of statements
 * will be initialized if it is <code>null</code>.
 * 
 * @param block
 * @param stmt
 */
public static void addStmt(BlockStmt block, Statement stmt) {
    List<Statement> stmts = block.getStmts();
    if (stmts == null) {
        stmts = new ArrayList<Statement>();
        block.setStmts(stmts);
    }
    stmts.add(stmt);
}
 
开发者ID:rfw,项目名称:genja,代码行数:16,代码来源:ASTHelper.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HtmlExporter类代码示例发布时间:2022-05-22
下一篇:
Java Layout类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap