Esempio n. 1
0
        public static StepExecutorScope CreateCurrentStepExecutorScope(ExecutionContext executionContext)
        {
            StepExecutorScope scope = new StepExecutorScope();

            scope.DataScope = new DataScope();
            scope.DataScope.Add(DataScope.RootScopeName, executionContext.DataContext.StateVariables);

            List <IIterator> activeIterators = executionContext.ExecutionStack.GetActiveIterators();

            for (int x = 0; x < activeIterators.Count; x++)
            {
                IIterator activeIterator = activeIterators[x];
                if (activeIterator is IObjectSetIterator)
                {
                    IObjectSetIterator objectSetIterator = (IObjectSetIterator)activeIterator;
                    bool isCurrentBranchIterator         = x == (activeIterators.Count - 1);

                    if (isCurrentBranchIterator && objectSetIterator is ElementSetIterator)
                    {
                        scope.ElementSetIterator = (ElementSetIterator)objectSetIterator;
                    }
                    if (objectSetIterator.CurrentObjectStateVariable != null)
                    {
                        scope.DataScope.Add(objectSetIterator.ObjectSetIteration.ObjectSetScopeName, objectSetIterator.CurrentObjectStateVariable.Value);
                    }
                }
            }
            return(scope);
        }
Esempio n. 2
0
        public void LoadScope(Step step, ExecutionContext context)
        {
            if (m_Step != null)
            {
                throw new InvalidOperationException("A scope is already loaded. Call ExecuteStep first to execute the step and unload the scope.");
            }
            m_Step    = (T)step;
            m_Context = context;

            this.CurrentScope = StepExecutorScope.CreateCurrentStepExecutorScope(context);
        }