private void CreateCounterContextsFrom(MultiRepeaterStatementNode theRepeater) { for (var i = 0; i < theRepeater.CounterDeclarations.CounterDeclarations.Count; i++) { var currentCounterDeclaration = theRepeater.CounterDeclarations.CounterDeclarations.ElementAt(i); var currentScopeDeclaration = theRepeater.ScopeDeclarations.ScopeDeclarations.ElementAt(i); CounterContext newCounter; if (currentScopeDeclaration.IsCount) { newCounter = new CounterContext(currentCounterDeclaration.CounterName, new CountIterator(CreateValueSourceFrom(currentScopeDeclaration.Count))); } else if (currentScopeDeclaration.IsScope) { newCounter = new CounterContext(currentCounterDeclaration.CounterName, new RangeIterator(CreateValueSourceFrom(currentScopeDeclaration.Scope.Start), CreateValueSourceFrom(currentScopeDeclaration.Scope.End))); } else { throw new NotImplementedException(); } this.counters.Add(newCounter); } }
/// <summary> /// Initialize the counter scope limit value with a counter context. /// </summary> /// <param name="theContext">Counter context.</param> public CounterLimitValueSource(CounterContext theContext) { this.context = theContext; }