예제 #1
0
        public void Parse(string fileName, LineStorage lines)
        {
            var    reader = new StreamReader(fileName);
            String line;

            while ((line = reader.ReadLine()) != null)
            {
                lines.Add(Line.Parse(line));
            }
        }
예제 #2
0
        public void IndexFile(string fileName)
        {
            var input = new Input();

            input.Parse(fileName, lines);

            var shifter = new CircularShifter();

            shifter.Shift(lines);
            lines = shifter.ShiftedLines;

            var alphabetizer = new Alphabetizer();

            alphabetizer.Sort(lines);
            lines = alphabetizer.SortedLines;
        }
예제 #3
0
        protected IEnumerable <Line> ShiftLine(Line line)
        {
            var shifts  = new LineStorage();
            var newLine = new Line(line);

            for (var i = 0; i <= line.Length - 1; i++)
            {
                shifts.Add(newLine);
                line    = newLine;
                newLine = new Line(line);

                var firstWord = line[0];

                for (var j = 1; j <= line.Length - 1; j++)
                {
                    newLine[j - 1] = line[j];
                }
                newLine[line.Length - 1] = firstWord;
            }
            return(shifts);
        }