コード例 #1
0
 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();
 }
コード例 #2
0
  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;
  }