예제 #1
0
        public SynchronizedCollectionWrapper(ICollection <T> underlyingCollection, SynchronizationToken synchronizationToken)
        {
            if (underlyingCollection == null)
            {
                throw new ArgumentNullException(nameof(underlyingCollection));
            }
            if (synchronizationToken == null)
            {
                throw new ArgumentNullException(nameof(synchronizationToken));
            }

            _underlyingCollection = underlyingCollection;
            _synchronizationToken = synchronizationToken;
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TextProcessor" /> class.
        /// </summary>
        public TextProcessor(ISyntaxParser syntaxParser, IExpressionScorer expressionScorer)
        {
            if (syntaxParser == null)
            {
                throw new ArgumentNullException(nameof(syntaxParser));
            }
            if (expressionScorer == null)
            {
                throw new ArgumentNullException(nameof(expressionScorer));
            }

            SyntaxParser     = syntaxParser;
            ExpressionScorer = expressionScorer;

            _commandProcessors    = new List <ICommandProcessor>();
            _textPreprocessors    = new List <ITextPreprocessor>();
            _synchronizationToken = new SynchronizationToken();

            CommandProcessors = new SynchronizedCollectionWrapper <ICommandProcessor>(_commandProcessors, _synchronizationToken);
            TextPreprocessors = new SynchronizedCollectionWrapper <ITextPreprocessor>(_textPreprocessors, _synchronizationToken);
        }