Esempio n. 1
0
        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);
                }
            }
        }
Esempio n. 2
0
 public void Process(INoteExtractor noteExtractor, string[] columns)
 {
     if (columns != null && columns.Length == 4)
     {
         _scheduleEntry.SetEntryNumber(ScheduleEntryLine.GetEntryNumber(columns[0]));
         _scheduleEntry.SetRegistrationDateAndPlanRef(columns[0]);
         _scheduleEntry.SetPropertyDescription(columns[1]);
         _scheduleEntry.SetDateOfLeaseAndTerm(columns[2]);
         _scheduleEntry.SetLesseeTitle(columns[3]);
         _scheduleEntry.SetNote(noteExtractor);
     }
 }
        /// <summary>
        /// Creates a new Schedule Entry record and extract all the lines relevant for the Entry Text
        /// </summary>
        /// <param name="entryStartLineIndex">new header line index</param>
        /// <param name="lines">all the data lines</param>
        /// <returns></returns>
        public ScheduleEntry Initialise(int entryStartLineIndex, List <string> lines)
        {
            EntryEndLineIndex = lines.Count;

            // add in the found header row text
            _scheduleEntry.EntryText.Add(lines[entryStartLineIndex]);

            // starting at the line after the HEADER, add rows of text up until you reach the next HEADER
            for (int i = entryStartLineIndex + 1; i < lines.Count; i++)
            {
                if (ScheduleEntryLine.IsHeader(lines[i]))
                {
                    EntryEndLineIndex = i;
                    break;
                }
                else
                {
                    _scheduleEntry.EntryText.Add(lines[i]);
                }
            }

            return(_scheduleEntry);
        }