public TravelEventParser(EventStream <TravelEvent> stream, DateTime year) // : base(stream) { // _currentEvent = base.HasNext() ? base.Peak() : null; _hazards = new List <ParseHazard>(); _parser = new EventParser <TravelEvent>(stream); _currentEvent = _parser.HasNext() ? _parser.MoveNext() : null; if (_currentEvent != null) { _top = _currentEvent.EventType == EventType.DepartureEvent ? _currentEvent.EventDate : new DateTime(year.Year, 12, 31); } else { // if _currentEvent is null, the eventstream is empty, and it's fully parsed. Return 0; _parsed = true; } }
public int Parse() { if (_parsed) { return(_runningSum); } while (_parser.HasNext()) { TravelEvent next = _parser.Peak(); if (_currentEvent.EventType == next.EventType) { _hazards.Add(new ParseHazard("Event mismatch detected.")); _currentEvent = _parser.MoveNext(); continue; } if (next.EventType == EventType.EntryEvent) { } } return(0); }