protected List<Operation> executeWithSameStack( ExecutionContext context, List<Action> actions, Operation parentOperation) throws StatementBlockException { StatementBlock block = CodeUtil.getStatementBlockReader(); context.getOperationStack().push(parentOperation); // save parent operation in operation stack block.setExecutionContext(context); block.read(actions); context.getOperationStack().pop(); // restore operation stack return block.getOperations(); }
protected BlockExecutionResult executeWithCopiedStack( ExecutionContext context, List<Action> actions, Operation parentOperation) throws StatementBlockException { StatementBlock block = CodeUtil.getStatementBlockReader(); context.getOperationStack().push(parentOperation); // save parent operation in operation stack Stack<Operation> currentExecutionStack = context.getExecStack(); // save current execution stack context.setExecStack(copyExecutionStack(currentExecutionStack)); // set a copy of current stack block.setExecutionContext(context); block.read(actions); BlockExecutionResult blockExecutionResult = new BlockExecutionResult(block.getOperations(), context.getExecStack()); context.setExecStack(currentExecutionStack); // restore previous execution stack context.getOperationStack().pop(); // restore operation stack return blockExecutionResult; }