本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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());
}