Example #1
0
        /// <summary>
        /// Get sweep line of instance scopes
        /// at end returns <c>null</c>
        /// </summary>
        /// <param name="view">View where scopes are stepped</param>
        /// <returns>Sweep line if there are available scopes, <c>null</c> otherwise</returns>
        public IEnumerable <InstanceScope> Step(ExecutionView view)
        {
            if (_enumerators == null)
            {
                //stepper is already at the end
                return(null);
            }

            var result      = (from enumerator in _enumerators select enumerator.Current).ToArray();
            var currentEnds = from scope in result select scope.End;

            var earliestEnd = view.EarliestBlock(currentEnds);

            foreach (var enumerator in _enumerators)
            {
                if (enumerator.Current.End == earliestEnd)
                {
                    if (!enumerator.MoveNext())
                    {
                        //there is no more scopes for instance
                        _enumerators = null;
                    }
                    break;
                }
            }

            return(result);
        }
Example #2
0
        public ScopeMonitor(IEnumerable <Instance> instances, ExecutionView view)
        {
            _monitoredInstances = new HashSet <Instance>(instances);

            var instanceStarts = from instance in instances where instance.CreationBlock != null select instance.CreationBlock;
            var earliestStart  = view.EarliestBlock(instanceStarts);

            initializeScopes(view, earliestStart);
        }