Example #1
0
        /// <summary>
        ///   Constructs a new <see cref="PrimitiveExtractionStep"/>.
        /// </summary>
        /// <param name="extractor">
        ///   The <see cref="IFieldExtractor"/> defining how the primitive value is to be obtained.
        /// </param>
        /// <param name="converter">
        ///   A <see cref="DataConverter"/> defining how to transform the primitive value extracted according to
        ///   <paramref name="extractor"/>. If no transformation is desired, an
        ///   <see cref="DataConverter.Identity{T}">identity conversion</see> should be provided.
        /// </param>
        /// <pre>
        ///   The <see cref="DataConverter.SourceType">SourceType</see> of <paramref name="converter"/> is the same as
        ///   the <see cref="IFieldExtractor.FieldType">FieldType</see> of <paramref name="extractor"/>, or is a base
        ///   class or interface thereof
        ///     --and--
        ///   The <see cref="IFieldExtractor.FieldType">FieldType</see> of <paramref name="extractor"/> is a data type
        ///   supported by the Framework.
        /// </pre>
        public PrimitiveExtractionStep(IFieldExtractor extractor, DataConverter converter)
        {
            Guard.Against.Null(extractor, nameof(extractor));
            Guard.Against.Null(converter, nameof(converter));
            Debug.Assert(extractor.FieldType.IsInstanceOf(converter.SourceType));
            Debug.Assert(DBType.IsSupported(converter.SourceType));

            extractor_     = extractor;
            converter_     = converter;
            ExpectedSource = extractor_.ExpectedSource;
        }
        /// <summary>
        ///   Constructs a new <see cref="DecomposingExtractionStep"/>.
        /// </summary>
        /// <param name="extractor">
        ///   The <see cref="IFieldExtractor"/> defining how the primitive value is to be obtained.
        /// </param>
        /// <param name="decomposition">
        ///   The steps defining how to decompose the value produced by <paramref name="extractor"/>.
        /// </param>
        /// <pre>
        ///  <paramref name="decomposition"/> is not empty
        ///    --and--
        ///   The <see cref="IExtractionStep.ExpectedSource">ExpectedSource</see> of each element of
        ///   <paramref name="decomposition"/> is the same as the <see cref="IFieldExtractor.FieldType">FieldType</see>
        ///   of <paramref name="extractor"/>, or is a base class or interface thereof
        ///     --and--
        ///   The <see cref="IFieldExtractor.FieldType">FieldType</see> of <paramref name="extractor"/> is a data type
        ///   not supported by the Framework.
        /// </pre>
        public DecomposingExtractionStep(IFieldExtractor extractor, IEnumerable <IExtractionStep> decomposition)
        {
            Guard.Against.Null(extractor, nameof(extractor));
            Guard.Against.Null(decomposition, nameof(decomposition));
            Debug.Assert(!decomposition.IsEmpty());
            Debug.Assert(decomposition.All(d => extractor.FieldType.IsInstanceOf(d.ExpectedSource)));
            Debug.Assert(!DBType.IsSupported(extractor.FieldType));         // otherwise decomposition is unnecessary

            extractor_     = extractor;
            decomposition_ = decomposition;
            ExpectedSource = extractor_.ExpectedSource;
        }
 /// <summary>
 /// Protected default constructor that defines <see cref="PassThroughFieldExtractor"/> as the default field extractor.
 /// </summary>
 protected ExtractorLineAggregator()
 {
     FieldExtractor = new PassThroughFieldExtractor();
 }
Example #4
0
 public FieldProcessor(IFieldExtractor extractor, IFieldAggregator[] aggregators)
 {
     this.extractor   = extractor ?? throw new ArgumentNullException(nameof(extractor));
     this.aggregators = aggregators ?? throw new ArgumentNullException(nameof(aggregators));
 }