Exemplo n.º 1
0
        public IList <ConferenceComponent> CalculateTalksForSession
            (IList <ConferenceComponent> allTalks, int maximumMinutes, int startingTime)
        {
            if (allTalks == null)
            {
                throw new ArgumentNullException();
            }

            if (maximumMinutes <= 0 || startingTime < 0)
            {
                throw new ArgumentOutOfRangeException();
            }

            var totalLength  = 0;
            var sessionTalks = new List <ConferenceComponent>();
            ConferenceComponent previousLeaf = null;

            foreach (var talk in allTalks)
            {
                if (totalLength + talk.Duration <= maximumMinutes)
                {
                    totalLength += talk.Duration;

                    talk.TimeStamp = previousLeaf != null
                        ? _timeService.CalculateTimeStampFromPrevious(previousLeaf.TimeStamp, previousLeaf.Duration)
                        : _timeService.CalculateStartingTimeStamp(startingTime);

                    sessionTalks.Add(talk);
                    previousLeaf = talk;
                }
            }

            return(sessionTalks);
        }
Exemplo n.º 2
0
 public ConferenceClient(ConferenceComponent component)
 {
     _component = component;
 }