Ejemplo n.º 1
0
 public void UnCut(CutLapsData cutLapsData)
 {
     foreach (Lap l in cutLapsData.CutLaps)
     {
         Add(l);
     }
     foreach (Lap l in cutLapsData.AddedLaps)
     {
         Remove(l);
     }
 }
Ejemplo n.º 2
0
        public CutLapsData Cut(DateTime time, CutType cutType)
        {
            var cutLapsData = new CutLapsData();

            switch (cutType)
            {
            case CutType.Before:
                foreach (var l in this)
                {
                    if (l.Time <= time)
                    {
                        cutLapsData.CutLaps.Add(l);
                    }
                }
                foreach (var l in cutLapsData.CutLaps)
                {
                    Remove(l);
                }
                if (cutLapsData.CutLaps.Count > 0)
                {
                    var newLap = new Lap(time, LapType.Start);
                    Add(newLap);
                    cutLapsData.AddedLaps.Add(newLap);
                }
                break;

            case CutType.After:
                foreach (var l in this)
                {
                    if (l.Time >= time)
                    {
                        cutLapsData.CutLaps.Add(l);
                    }
                }
                foreach (var l in cutLapsData.CutLaps)
                {
                    Remove(l);
                }
                if (cutLapsData.CutLaps.Count > 0)
                {
                    var newLap = new Lap(time, LapType.Stop);
                    Add(newLap);
                    cutLapsData.AddedLaps.Add(newLap);
                }
                break;
            }
            return(cutLapsData);
        }