ForControlContext forControlContext = getChild(context, ForControlContext.class);
if (forControlContext != null) {
EnhancedForControlContext enhancedForControlContext =
getChild(forControlContext, EnhancedForControlContext.class);
if (enhancedForControlContext == null) {
LoopControl loopControl = createNode(forControlContext, LoopControl.class);
ForInitContext forInitContext = getChild(forControlContext, ForInitContext.class);
if (forInitContext != null) {
LocalVariableDeclarationContext localVariableDeclarationContext =
getChild(forInitContext, LocalVariableDeclarationContext.class);
if (localVariableDeclarationContext != null) {
loopControl.setVariableDeclaration(
getAdapter(LocalVariableDeclarationAdapter.class).adapt(
localVariableDeclarationContext));
}
ExpressionListContext expressionListContext =
getChild(forControlContext, ExpressionListContext.class);
if (expressionListContext != null) {
loopControl.setInitExpressions(
getAdapter(ExpressionListAdapter.class).adapt(expressionListContext));
}
}
ExpressionContext expressionContext = getChild(forControlContext, ExpressionContext.class);
if (expressionContext != null) {
loopControl.setCondition(getAdapter(ExpressionAdapter.class).adapt(expressionContext));
}
ForUpdateContext forUpdateContext = getChild(forControlContext, ForUpdateContext.class);
if (forUpdateContext != null) {
ExpressionListContext expressionListContext =
getChild(forUpdateContext, ExpressionListContext.class);
if (expressionListContext != null) {
loopControl.setUpdateExpressions(
getAdapter(ExpressionListAdapter.class).adapt(expressionListContext));
}
}
forStatement.setControl(loopControl);