Esempio n. 1
0
 private Result <HashSet <string> > FormWords(string path, ReaderFinder readerFinder, Filter filter)
 {
     return(ReadWords(path, readerFinder)
            .Then(filter.FilterWords)
            .Then(wordConverter.ConvertWords)
            .Then(words => words.ToHashSet()));
 }
Esempio n. 2
0
 private Result <HashSet <string> > ReadWords(string path, ReaderFinder readerFinder)
 {
     return(File.Exists(path)
            .AsResult()
            .FailIf(e => !e, $"Файла {path} не существует")
            .Then(e => readerFinder.Find(path))
            .Then(reader => reader.ReadWords(path))
            .Then(words => words.ToHashSet())
            .OnFail(HandleError));
 }
Esempio n. 3
0
 public ApplicationCore(ReaderFinder readerFinder,
                        IImageBuilder tagCloudImageBuilder, ILayoutAlgorithm layoutAlgorithm,
                        IImageSaver imageSaver,
                        Filter filter, WordConverter wordConverter)
 {
     this.filter               = filter;
     this.wordConverter        = wordConverter;
     this.readerFinder         = readerFinder;
     this.tagCloudImageBuilder = tagCloudImageBuilder;
     this.imageSaver           = imageSaver;
     this.layoutAlgorithm      = layoutAlgorithm;
 }
Esempio n. 4
0
 private Result <HashSet <string> > FormBoringWords(string path, ReaderFinder readerFinder, Filter filter)
 {
     return(path == null
         ? Result.Ok(new HashSet <string>())
         : FormWords(path, readerFinder, filter));
 }