예제 #1
0
        private static Pair ParsePair(DirtyPair pair, int firstWeek)
        {
            var group       = GroupParser.Parse(pair.Group);
            var dayOfWeek   = DayOfWeekParser.Parse(pair.DayOfWeek);
            var defaultTime = TimeRangeParser.Parse(pair.Time);

            string content = pair.Content;

            var time      = RedefinedTimeParser.Parse(content, defaultTime, out content);
            var frequency = FrequencyParser.Parse(content, firstWeek, out content);
            var type      = PairTypeParser.Parse(content, out content);
            var teacher   = TeacherParser.Parse(content, out content);
            var room      = RoomParser.Parse(content, out content);
            var subject   = content.Trim(' ', '.');

            return(new Pair
            {
                Group = group,
                Teacher = teacher,
                DayOfWeek = dayOfWeek,
                Room = room,
                Type = type,
                TimeRange = time,
                Subject = subject,
                Frequency = frequency,
                OriginalText = pair.Content
            });
        }
예제 #2
0
        private static Pair ParseSimplePair(DirtyPair pair)
        {
            var group     = GroupParser.Parse(pair.Group);
            var dayOfWeek = DayOfWeekParser.Parse(pair.DayOfWeek);
            var time      = TimeRangeParser.Parse(pair.Time);

            return(new Pair
            {
                Group = group,
                DayOfWeek = dayOfWeek,
                TimeRange = time,
                Subject = pair.Content,
                OriginalText = pair.Content
            });
        }