@Override public <T extends CtStatementList> T insertBefore(Filter<? extends CtStatement> insertionPoints, CtStatementList statements) { for (CtStatement e : Query.getElements(this, insertionPoints)) { e.insertBefore(statements); } return (T) this; }
@Override public <T extends CtStatementList> T insertBefore(Filter<? extends CtStatement> insertionPoints, CtStatement statement) { for (CtStatement e : Query.getElements(this, insertionPoints)) { e.insertBefore(statement); } return (T) this; }
@Override public <T extends CtStatementList> T insertBefore(Filter<? extends CtStatement> insertionPoints, CtStatementList statements) { for (CtStatement e : Query.getElements(this, insertionPoints)) { e.insertBefore(statements); } return (T) this; }
@Override public <T extends CtStatementList> T insertBefore(Filter<? extends CtStatement> insertionPoints, CtStatement statement) { for (CtStatement e : Query.getElements(this, insertionPoints)) { e.insertBefore(statement); } return (T) this; }
@Override public <T extends CtStatementList> T insertBefore(Filter<? extends CtStatement> insertionPoints, CtStatementList statements) { for (CtStatement e : Query.getElements(this, insertionPoints)) { e.insertBefore(statements); } return (T) this; }
@Override public <T extends CtStatementList> T insertBefore(Filter<? extends CtStatement> insertionPoints, CtStatement statement) { for (CtStatement e : Query.getElements(this, insertionPoints)) { e.insertBefore(statement); } return (T) this; }
@Override public <T extends CtBlock<R>> T insertBefore( Filter<? extends CtStatement> insertionPoints, CtStatementList statements) { for (CtStatement e : Query.getElements(this, insertionPoints)) { e.insertBefore(statements); } return (T) this; }
@Override public <T extends CtBlock<R>> T insertBefore( Filter<? extends CtStatement> insertionPoints, CtStatement statement) { for (CtStatement e : Query.getElements(this, insertionPoints)) { e.insertBefore(statement); } return (T) this; }
public static void insertBeforeUnderSameParent(CtStatement toBeInserted, CtStatement insertionPoint) { CtElement parent; if (isBlock(insertionPoint)) { CtBlock<?> block = (CtBlock<?>) insertionPoint; block.insertBegin(toBeInserted); parent = block; } else { insertionPoint.insertBefore(toBeInserted); parent = insertionPoint.getParent(); } setParent(parent, toBeInserted); }
private CtMethod<?> apply(CtMethod<?> method, CtInvocation<?> invocation) { final CtInvocation<?> invocationToBeInserted = invocation.clone(); final CtStatement insertionPoint = this.getRightInsertionPoint(invocation); insertionPoint.insertBefore(invocationToBeInserted); final CtMethod<?> clone = CloneHelper.cloneTestMethodForAmp(method, "_add"); AmplifierHelper.getParent(invocationToBeInserted).getStatements().remove(invocationToBeInserted); Counter.updateInputOf(clone, 1); return clone; }
@Override public boolean applyChangesInModel(OperatorInstance operation, ProgramVariant p) { boolean successful = false; CtStatement ctst = (CtStatement) operation.getOriginal(); CtStatement fix = (CtStatement) operation.getModified(); StatementOperatorInstance stmtoperator = (StatementOperatorInstance) operation; CtBlock parentBlock = stmtoperator.getParentBlock(); if (parentBlock != null) { ctst.insertBefore((CtStatement) fix); fix.setParent(parentBlock); successful = true; operation.setSuccessfulyApplied(successful); StatementSupporter.updateBlockImplicitly(parentBlock, true); } else { log.error("Operation not applied. Parent null "); } return successful; }
.getLastStatement(); if (lastStatement instanceof CtReturn) { lastStatement.insertBefore(list_call); } else { lastStatement.insertAfter(list_call);
private void replaceInvocationByLocalVariable(CtStatement invocationToBeReplaced, CtLocalVariable localVariable) { if (invocationToBeReplaced.getParent() instanceof CtBlock) { invocationToBeReplaced.replace(localVariable); } else { CtElement parent = invocationToBeReplaced.getParent(); while (!(parent.getParent() instanceof CtBlock)) { parent = invocationToBeReplaced.getParent(); } ((CtStatement) parent).insertBefore(localVariable); invocationToBeReplaced.replace(localVariable.getReference()); } }