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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations