コード例 #1
0
        /// <summary>
        /// Change unstructured entry text into a data structure representing the actual text for each Schedule Entry column
        /// </summary>
        /// <param name="entryText"></param>
        /// <returns></returns>
        public string[] Build(List <string> entryText)
        {
            Matrix matrix = new Matrix();

            for (int entryIndex = 0; entryIndex < entryText.Count; entryIndex++)
            {
                string line = entryText[entryIndex];

                if (string.IsNullOrWhiteSpace(line))
                {
                    continue;
                }

                if (_noteExtractor.IsNotesLine(line))
                {
                    // notes are always at the end of the schedule entry
                    break;
                }

                // Put the unstructured EntryText values into a fixed DataRow structure and add to a matrix
                DataRow dataRow = _dataEngineColumnRuleEngine.Run(line, _whiteSpaceCalculator);

                if (dataRow != null)
                {
                    matrix.AddRow(dataRow);
                }
                else
                {
                    return(null);
                }
            }

            // Sslice vertically through all data rows to produce columns and append the contents of each column togetther
            return(matrix.PivotToColumns());
        }