Пример #1
0
        public void Main()
        {
            var journal = new Journal();

            journal.AddEntry("First entry");
            journal.AddEntry("Second entry");
            journal.AddEntry("Third entry");

            var storage = new JournalSource(journal);

            storage.SaveToFile("journal.txt");
        }
        public Pipeline(JournalSource journalSource, JournalEntryParser journalEntryParser, Summarizer summarizer, OutputFormatter outputFormatter, string supportedMinorFaction)
        {
            if (string.IsNullOrEmpty(supportedMinorFaction))
            {
                throw new ArgumentException($"'{nameof(supportedMinorFaction)}' cannot be null or empty", nameof(supportedMinorFaction));
            }

            JournalSource         = journalSource ?? throw new ArgumentNullException(nameof(journalSource));
            JournalEntryParser    = journalEntryParser ?? throw new ArgumentNullException(nameof(journalEntryParser));
            Summarizer            = summarizer ?? throw new ArgumentNullException(nameof(summarizer));
            OutputFormatter       = outputFormatter ?? throw new ArgumentNullException(nameof(outputFormatter));
            SupportedMinorFaction = supportedMinorFaction;
        }
Пример #3
0
 /// <summary>
 /// Add an journal entry to the day.
 /// </summary>
 /// <param name="source">The source of the entry.</param>
 /// <param name="score">The entropy score of the entry.</param>
 public void Add(JournalSource source, float score)
 {
     Debug.LogFormat("Adding journal entry for {0} : {1}", source, score);
     this.Add(new JournalEntry(source, score));
 }
Пример #4
0
 /// <summary>
 /// Create a new journal entry.
 /// </summary>
 /// <param name="source">The source of the entry.</param>
 /// <param name="score">The entropy score of this entry.</param>
 public JournalEntry(JournalSource source, float score)
 {
     this.source = source;
     this.score  = score;
 }
Пример #5
0
 /// <summary>
 /// Add an entry to today's journal entry.
 /// </summary>
 /// <param name="source">The source of the entry.</param>
 /// <param name="score">The entropy score of the entry.</param>
 public void Add(JournalSource source, float score)
 {
     this.today.Add(source, score);
 }