spoon.reflect.code.CtFor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spoon-core Show documentation
Show all versions of spoon-core Show documentation
Spoon is a tool for meta-programming, analysis and transformation of Java programs.
/*
* SPDX-License-Identifier: (MIT OR CECILL-C)
*
* Copyright (C) 2006-2023 INRIA and contributors
*
* Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) or the Cecill-C License (see LICENSE-CECILL-C.txt). You as the user are entitled to choose the terms under which to adopt Spoon.
*/
package spoon.reflect.code;
import spoon.reflect.annotations.PropertyGetter;
import spoon.reflect.annotations.PropertySetter;
import java.util.List;
import static spoon.reflect.path.CtRole.EXPRESSION;
import static spoon.reflect.path.CtRole.FOR_INIT;
import static spoon.reflect.path.CtRole.FOR_UPDATE;
/**
* This code element defines a for loop.
* Example:
*
* // a for statement
* for(int i=0; i<10; i++) {
* System.out.println("foo");
* }
*
*/
public interface CtFor extends CtLoop {
/**
* Gets the end-loop test expression.
*/
@PropertyGetter(role = EXPRESSION)
CtExpression getExpression();
/**
* Sets the end-loop test expression.
*/
@PropertySetter(role = EXPRESSION)
T setExpression(CtExpression expression);
/**
* Gets the init statements.
*/
@PropertyGetter(role = FOR_INIT)
List getForInit();
/**
* Adds an init statement.
*/
@PropertySetter(role = FOR_INIT)
T addForInit(CtStatement statement);
/**
* Sets the init statements.
*/
@PropertySetter(role = FOR_INIT)
T setForInit(List forInit);
/**
* Removes an init statement.
*/
@PropertySetter(role = FOR_INIT)
boolean removeForInit(CtStatement statement);
/**
* Gets the update statements.
*/
@PropertyGetter(role = FOR_UPDATE)
List getForUpdate();
/**
* Adds an update statement.
*/
@PropertySetter(role = FOR_UPDATE)
T addForUpdate(CtStatement statement);
/**
* Sets the update statements.
*/
@PropertySetter(role = FOR_UPDATE)
T setForUpdate(List forUpdate);
/**
* Removes an update statement.
*/
@PropertySetter(role = FOR_UPDATE)
boolean removeForUpdate(CtStatement statement);
@Override
CtFor clone();
}