Пример #1
0
        public ProjectR()
        {
            _stateSyncer = Factories.RFactory.CreateStateMachineSynchronizer();
            _model       = Factories.RFactory.CreateModel();
            _view        = Factories.RFactory.CreateConsoleView();
            _logic       = Factories.RFactory.CreateLogic();

            ExitHelper.ExitAction = Exit;
        }
Пример #2
0
        public RDetector(RDetectorConfig config, IRModel model)
        {
            config.ThrowIfNull("config");
            model.ThrowIfNull("model");
            config.UrlDetectorModel.ThrowIfNull("config.UrlDetectorModel");

            Threshold = config.Threshold;
            CyrillicLettersPercent = config.CyrillicLettersPercent;
            _Model     = model;
            _Tokenizer = new mld_tokenizer(config.UrlDetectorModel);
            _Sb        = new StringBuilder(50);
        }
Пример #3
0
        public ConcurrentFactory(RDetectorConfig config, IRModel model, int instanceCount)
        {
            if (instanceCount <= 0)
            {
                throw (new ArgumentException("instanceCount"));
            }
            if (config == null)
            {
                throw (new ArgumentNullException("config"));
            }
            if (model == null)
            {
                throw (new ArgumentNullException("model"));
            }

            _InstanceCount = instanceCount;
            _Semaphore     = new Semaphore(_InstanceCount, _InstanceCount);
            _Stack         = new ConcurrentStack <ILanguageDetector>();
            for (int i = 0; i < _InstanceCount; i++)
            {
                _Stack.Push(new RDetector(config, model));
            }
            //_IRModel = model;
        }