private void AddTagsToCurrentLine(ILineInterface currentLine, List <ITag> tags)
        {
            IStationInterface           previousStation;
            IStationInterface           currentStation           = null;
            IStationConnectionInterface currentStationConnection = null;
            List <IStationInterface>    stations = new List <IStationInterface>();

            foreach (ITag tag in tags)
            {
                switch (tag.TagType)
                {
                case DataEnums.STATION:
                    previousStation = currentStation;
                    IStationInterface tempStation = ParseStation(tag.Value);
                    currentStation = StationAlreadyInList(tempStation)
                            ? GetStation(tempStation.Name)
                            : tempStation;

                    stations.Add(currentStation);

                    ConnectStations(currentStation, previousStation, currentStationConnection);
                    currentStationConnection = null;
                    break;

                case DataEnums.TIME:
                    currentStationConnection = ParseStationConnection(tag.Value);
                    break;
                }
            }
            currentLine.Stations = stations.ToArray();
        }
        private ITrainNetwork Parse(string[] content)
        {
            List <ILineInterface> lines           = new List <ILineInterface>();
            ILineInterface        currentLine     = null;
            List <ITag>           currentLineTags = new List <ITag>();

            foreach (string dataLine in content)
            {
                switch (DetermineContentType(dataLine))
                {
                case DataEnums.LINE:
                    if (currentLine != null)
                    {
                        AddTagsToCurrentLine(currentLine, currentLineTags);
                        stationList.AddRange(currentLine.Stations);
                        currentLineTags.Clear();
                    }
                    currentLine = ParseLine(dataLine);
                    lines.Add(currentLine);
                    break;

                case DataEnums.STATION:
                    currentLineTags.Add(GetStationTag(dataLine));
                    break;

                case DataEnums.TIME:
                    currentLineTags.Add(GetTimeTag(dataLine));
                    break;
                }
            }
            if (currentLineTags.Count > 0 && currentLine != null)
            {
                AddTagsToCurrentLine(currentLine, currentLineTags);
            }

            return(new TrainNetworkModel(lines.ToArray()));
        }