コード例 #1
0
        /// <summary>
        /// Initializes the chain of responsability
        /// </summary>
        /// <param name="client"></param>
        public void Initialize(Client client)
        {
            CharCounterExcludingN      charCounterExcludingN      = new CharCounterExcludingN();
            ParagraphsCounter          paragraphsCounter          = new ParagraphsCounter();
            PhraseMoreThanFifteenWords phraseMoreThanFifteenWords = new PhraseMoreThanFifteenWords();
            WordEndingWithLowerN       wordEndingWithLowerN       = new WordEndingWithLowerN();

            charCounterExcludingN.NextAnalyzer      = paragraphsCounter;
            paragraphsCounter.NextAnalyzer          = phraseMoreThanFifteenWords;
            phraseMoreThanFifteenWords.NextAnalyzer = wordEndingWithLowerN;

            Statistic resultStatistic = new Statistic(client);

            charCounterExcludingN.AnalyzeContent(resultStatistic);

            LogBook lb = LogBook.LogBookIns();

            lb.WriteToDisk(client.Id.ToString(), resultStatistic.ToString());
        }