Search in sources :

Example 1 with STATEMENT

use of spoon.reflect.path.CtRole.STATEMENT in project spoon by INRIA.

the class CtBlockImpl method setStatements.

@Override
public <T extends CtStatementList> T setStatements(List<CtStatement> statements) {
    if (statements == null || statements.isEmpty()) {
        this.statements = CtElementImpl.emptyList();
        return (T) this;
    }
    getFactory().getEnvironment().getModelChangeListener().onListDeleteAll(this, STATEMENT, this.statements, new ArrayList<>(this.statements));
    this.statements.clear();
    for (CtStatement s : statements) {
        addStatement(s);
    }
    return (T) this;
}
Also used : STATEMENT(spoon.reflect.path.CtRole.STATEMENT) CtStatement(spoon.reflect.code.CtStatement)

Example 2 with STATEMENT

use of spoon.reflect.path.CtRole.STATEMENT in project spoon by INRIA.

the class CtCaseImpl method setStatements.

@Override
public <T extends CtStatementList> T setStatements(List<CtStatement> statements) {
    if (statements == null || statements.isEmpty()) {
        this.statements = CtElementImpl.emptyList();
        return (T) this;
    }
    getFactory().getEnvironment().getModelChangeListener().onListDeleteAll(this, STATEMENT, this.statements, new ArrayList<>(this.statements));
    this.statements.clear();
    for (CtStatement stmt : statements) {
        addStatement(stmt);
    }
    return (T) this;
}
Also used : STATEMENT(spoon.reflect.path.CtRole.STATEMENT) CtStatement(spoon.reflect.code.CtStatement)

Example 3 with STATEMENT

use of spoon.reflect.path.CtRole.STATEMENT in project spoon by INRIA.

the class CtStatementListImpl method insertBegin.

@Override
public <T extends CtStatementList> T insertBegin(CtStatementList statements) {
    ensureModifiableStatementsList();
    for (CtStatement statement : statements.getStatements()) {
        statement.setParent(this);
        this.addStatement(0, statement);
    }
    if (isImplicit() && this.statements.size() > 1) {
        setImplicit(false);
    }
    return (T) this;
}
Also used : STATEMENT(spoon.reflect.path.CtRole.STATEMENT) CtStatement(spoon.reflect.code.CtStatement)

Example 4 with STATEMENT

use of spoon.reflect.path.CtRole.STATEMENT in project spoon by INRIA.

the class CtStatementListImpl method setStatements.

@Override
public <T extends CtStatementList> T setStatements(List<CtStatement> stmts) {
    if (stmts == null || stmts.isEmpty()) {
        this.statements = CtElementImpl.emptyList();
        return (T) this;
    }
    getFactory().getEnvironment().getModelChangeListener().onListDeleteAll(this, STATEMENT, this.statements, new ArrayList<>(this.statements));
    this.statements.clear();
    for (CtStatement stmt : stmts) {
        addStatement(stmt);
    }
    return (T) this;
}
Also used : STATEMENT(spoon.reflect.path.CtRole.STATEMENT) CtStatement(spoon.reflect.code.CtStatement)

Example 5 with STATEMENT

use of spoon.reflect.path.CtRole.STATEMENT in project spoon by INRIA.

the class CtBlockImpl method insertBegin.

@Override
public <T extends CtStatementList> T insertBegin(CtStatementList statements) {
    if (this.shouldInsertAfterSuper()) {
        getStatements().get(0).insertAfter(statements);
        return (T) this;
    }
    ensureModifiableStatementsList();
    for (CtStatement statement : statements.getStatements()) {
        statement.setParent(this);
        this.addStatement(0, statement);
    }
    if (isImplicit() && this.statements.size() > 1) {
        setImplicit(false);
    }
    return (T) this;
}
Also used : STATEMENT(spoon.reflect.path.CtRole.STATEMENT) CtStatement(spoon.reflect.code.CtStatement)

Aggregations

CtStatement (spoon.reflect.code.CtStatement)6 STATEMENT (spoon.reflect.path.CtRole.STATEMENT)6