public TreeService(ITreeChecker <T> checker, ITreeEditor <T> editor, ITreeStorage <T> storage, ITreeTraverser <T> visualizer) { this.checker = Helpers.Check(checker, nameof(checker)); this.editor = Helpers.Check(editor, nameof(editor)); this.storage = Helpers.Check(storage, nameof(storage)); this.visualizer = Helpers.Check(visualizer, nameof(visualizer)); }
public SuperTranslator(TextReader reader, ITreeStorage storage, int maxThreadCount = 0) : base(reader, storage) { if (maxThreadCount == 0) { _factory = new TaskFactory(); } else { //если maxThreadCount!=0, то создаем планировщик для управления кол-ом параллельно создаваемых потоков LimitedConcurrencyLevelTaskScheduler lcts = new LimitedConcurrencyLevelTaskScheduler(maxThreadCount); _factory = new TaskFactory(lcts); } string line = null; while ((line = _reader.ReadLine()) != null) { _storage.Add(line.Split('\t')[0], line.Split('\t')[1]); } }
public TreeTranslator(TextReader reader, ITreeStorage storage) { _reader = reader; _storage = storage; }