public void CreateScheduleEntries() { // lopp through all data lines looking for header lines which determine a new Schedule Entry for (int index = 0; index < _dataLines.Count; index++) { if (ScheduleEntryLine.IsHeader(_dataLines[index])) { int entryStartLineIndex = index; // get the lines of text that constitute a schedule entry and intialise to a new ScheduleEntry ScheduleEntryInitialiser scheduleEntryInitialiser = new ScheduleEntryInitialiser(); ScheduleEntry scheduleEntry = scheduleEntryInitialiser.Initialise(entryStartLineIndex, _dataLines); // getting EntryText into a fixed column data structure EntryTextColumnBuilder builder = new EntryTextColumnBuilder(_ruleEngine, _whiteSpaceCalculator, _noteExtractor); string[] scheduleEntryColumns = builder.Build(scheduleEntry.EntryText); // setting relevant properties on Schedule Entry by using colum data ScheduleEntrySetter method = new ScheduleEntrySetter(scheduleEntry); method.Process(_noteExtractor, scheduleEntryColumns); // fast forward the loop to the already known next HEADER line index = scheduleEntryInitialiser.EntryEndLineIndex - 1; // add initialised entry to collection ScheduleEntries.Add(scheduleEntry); } } }
public MxfService getService(string stationId) { if (!_services.TryGetValue(stationId, out MxfService service)) { Services.Add(service = new MxfService() { index = Services.Count + 1, StationID = stationId }); ScheduleEntries.Add(service.mxfScheduleEntries); _services.Add(stationId, service); } return(service); }
public MxfService GetService(string stationId) { if (_services.TryGetValue(stationId, out var service)) { return(service); } Services.Add(service = new MxfService() { Index = Services.Count + 1, StationId = stationId }); ScheduleEntries.Add(service.MxfScheduleEntries); _services.Add(stationId, service); return(service); }