Ejemplo n.º 1
0
        public LogSampleProvider(LogFileReader reader, IEnumerable<string> groups, int startTime, int endTime)
        {
            Reader = reader;
            _groups = groups.ToList();
            StartTime = startTime;
            EndTime = endTime;

            // Make base sample.
            TimeLine = reader.Groups.SelectMany(x => x.Timeline.Keys).Distinct().OrderBy(x => x).ToList();

            // If this time doesn't exist; search the closest related.
            if (!TimeLine.Contains(startTime))
                startTime = TimeLine.Select(x => x - startTime).OrderBy(x => x).Take(1).FirstOrDefault() + startTime;

            Sample = new LogSample(this, startTime, groups.Select(reader.GetGroup));

            InitializeSample(Sample, startTime);
        }
Ejemplo n.º 2
0
 protected void UpdateSampleValues(LogSample sample, int timestamp)
 {
     Sample.UpdateTime(timestamp);
     foreach (var group in sample.Groups.Values)
         ((LogSampleGroup)group).Update(timestamp, true);
 }
Ejemplo n.º 3
0
 protected void InitializeSample(LogSample sample, int timestamp)
 {
     Sample.UpdateTime(timestamp);
     foreach (var group in sample.Groups.Values)
         ((LogSampleGroup)group).Update(timestamp, false);
 }