Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TextProcessor" /> class.
 /// </summary>
 public TextProcessor(ISyntaxParser syntaxParser, IExpressionScorer expressionScorer, ITextSplitter textSplitter = null)
 {
     SyntaxParser      = syntaxParser ?? throw new ArgumentNullException(nameof(syntaxParser));
     ExpressionScorer  = expressionScorer ?? throw new ArgumentNullException(nameof(expressionScorer));
     TextSplitter      = textSplitter;
     CommandProcessors = new List <ICommandProcessor>();
     TextPreprocessors = new List <ITextPreprocessor>();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TextcMessageReceiverBuilder"/> class.
 /// </summary>
 /// <param name="clientBuilder">The client builder.</param>
 /// <param name="outputProcessor">The output processor.</param>
 /// <param name="syntaxParser">The syntax parser.</param>
 /// <param name="expressionScorer">The expression scorer.</param>
 /// <param name="cultureProvider">The culture provider.</param>
 public TextcMessageReceiverBuilder(
     MessagingHubClientBuilder clientBuilder,
     IOutputProcessor outputProcessor   = null,
     ISyntaxParser syntaxParser         = null,
     IExpressionScorer expressionScorer = null,
     ICultureProvider cultureProvider   = null)
     : this(clientBuilder.Build(), outputProcessor, syntaxParser, expressionScorer, cultureProvider)
 {
 }
 /// <summary>
 /// Defines a expression scorer to be used by the instance of <see cref="TextProcessor"/> for the current <see cref="TextcMessageReceiver"/>.
 /// </summary>
 /// <param name="expressionScorer">The expression scorer instance.</param>
 /// <returns></returns>
 public TextcMessageReceiverBuilder WithExpressionScorer(IExpressionScorer expressionScorer)
 {
     if (expressionScorer == null)
     {
         throw new ArgumentNullException(nameof(expressionScorer));
     }
     _expressionScorer = expressionScorer;
     return(this);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TextcMessageReceiverBuilder"/> class.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="outputProcessor">The output processor.</param>
 /// <param name="syntaxParser">The syntax parser.</param>
 /// <param name="expressionScorer">The expression scorer.</param>
 /// <param name="cultureProvider">The culture provider.</param>
 public TextcMessageReceiverBuilder(
     IMessagingHubSender sender,
     IOutputProcessor outputProcessor   = null,
     ISyntaxParser syntaxParser         = null,
     IExpressionScorer expressionScorer = null,
     ICultureProvider cultureProvider   = null)
 {
     _sender                    = sender;
     _outputProcessor           = outputProcessor ?? new MessageOutputProcessor(sender);
     _syntaxParser              = syntaxParser ?? new SyntaxParser();
     _expressionScorer          = expressionScorer ?? new RatioExpressionScorer();
     _cultureProvider           = cultureProvider ?? new DefaultCultureProvider(CultureInfo.InvariantCulture);
     _commandProcessorFactories = new List <Func <IOutputProcessor, ICommandProcessor> >();
     _textPrePreprocessors      = new List <ITextPreprocessor>();
 }
Esempio n. 5
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);
        }
Esempio n. 6
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);
        }
 public SlidingTextProcessor(ISyntaxParser syntaxParser, IExpressionScorer expressionScorer, ITextSplitter textSplitter = null)
     : base(syntaxParser, expressionScorer, textSplitter)
 {
 }