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


Java ForStatement.initializers方法代码示例

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


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

示例1: isForStatementInit

import org.eclipse.jdt.core.dom.ForStatement; //导入方法依赖的package包/类
private boolean isForStatementInit(Statement statement, SimpleName name) {
	if (statement instanceof ForStatement) {
		ForStatement forStatement= (ForStatement) statement;
		List<Expression> list = forStatement.initializers();
		if (list.size() == 1 && list.get(0) instanceof Assignment) {
			Assignment assignment= (Assignment) list.get(0);
			return assignment.getLeftHandSide() == name;
		}
	}
	return false;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:12,代码来源:NewVariableCorrectionProposal.java

示例2: isForStatementInit

import org.eclipse.jdt.core.dom.ForStatement; //导入方法依赖的package包/类
private boolean isForStatementInit(Statement statement, SimpleName name) {
  if (statement instanceof ForStatement) {
    ForStatement forStatement = (ForStatement) statement;
    List<Expression> list = forStatement.initializers();
    if (list.size() == 1 && list.get(0) instanceof Assignment) {
      Assignment assignment = (Assignment) list.get(0);
      return assignment.getLeftHandSide() == name;
    }
  }
  return false;
}
 
开发者ID:eclipse,项目名称:che,代码行数:12,代码来源:NewVariableCorrectionProposal.java

示例3: visit

import org.eclipse.jdt.core.dom.ForStatement; //导入方法依赖的package包/类
/**
 * We don't really need anything in particular from this statement,
 * but since it has an expression and a body, we only want to 
 * investigate the expression part to determine if it needs to
 * be in the slice.
 */
public boolean visit(ForStatement node){
	if(this.options.contains(Slicer.Options.CONTROL_EXPRESSIONS_ONLY)){
		/* Visit the expression part. */
		node.getExpression().accept(this);
		List<Expression> initializers = node.initializers();
		for(Expression initializer : initializers){
			initializer.accept(this);
		}
		/* Don't visit the children. */
		return false;
	}
	else return true;
}
 
开发者ID:qhanam,项目名称:Slicer,代码行数:20,代码来源:FDDSeedVisitor.java

示例4: visit

import org.eclipse.jdt.core.dom.ForStatement; //导入方法依赖的package包/类
/**
 * We want to track the variables from the expression only.
 */
public boolean visit(ForStatement node){
	/* Visit the expression part. */
	node.getExpression().accept(this);
	List<Expression> initializers = node.initializers();
	for(Expression initializer : initializers){
		initializer.accept(this);
	}
	/* Don't visit the children. */
	return false;
}
 
开发者ID:qhanam,项目名称:Slicer,代码行数:14,代码来源:FDDVisitor.java

示例5: write

import org.eclipse.jdt.core.dom.ForStatement; //导入方法依赖的package包/类
@Override
public void write(ForStatement forStatement) {
    matchAndWrite("for");

    copySpaceAndComments();
    matchAndWrite("(");

    copySpaceAndComments();
    boolean first = true;
    for (Object initializerExpressionObject : forStatement.initializers()) {
        Expression initializerExpression = (Expression) initializerExpressionObject;

        if (!first) {
            matchAndWrite(",");
            copySpaceAndComments();
        }

        writeNode(initializerExpression);
        copySpaceAndComments();

        first = false;
    }

    matchAndWrite(";");

    copySpaceAndComments();
    Expression forExpression = forStatement.getExpression();
    if (forExpression != null) {
        writeNode(forStatement.getExpression());
        copySpaceAndComments();
    }

    matchAndWrite(";");

    copySpaceAndComments();
    first = true;
    for (Object updaterExpressionObject : forStatement.updaters()) {
        Expression updaterExpression = (Expression) updaterExpressionObject;

        if (!first) {
            matchAndWrite(",");
            copySpaceAndComments();
        }

        writeNode(updaterExpression);
        copySpaceAndComments();

        first = false;
    }

    matchAndWrite(")");

    copySpaceAndComments();
    writeNode(forStatement.getBody());
}
 
开发者ID:juniversal,项目名称:juniversal,代码行数:56,代码来源:ForStatementWriter.java


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