コード例 #1
0
        /// <inheritdoc cref="StandardScanShareableAnalyzer{S}.FromAggregationResult"/>
        public virtual DoubleMetric FromAggregationResult(Row result, int offset)
        {
            if (result.Values.Length <= offset || result[offset] == null)
            {
                return(AnalyzersExt.MetricFromEmpty(this, Name, string.Join(',', Columns),
                                                    AnalyzersExt.EntityFrom(Columns)));
            }

            return(ToSuccessMetric(result.GetAs <double>(offset)));
        }
コード例 #2
0
        /// <inheritdoc cref="ScanShareableAnalyzer{S,M}.ComputeMetricFrom"/>
        public override DoubleMetric ComputeMetricFrom(Option <FrequenciesAndNumRows> state)
        {
            if (!state.HasValue)
            {
                return(AnalyzersExt.MetricFromEmpty(this, Name, string.Join(',', Columns),
                                                    AnalyzersExt.EntityFrom(Columns)));
            }

            IEnumerable <Column> aggregations = AggregationFunctions(state.Value.NumRows);
            Row result = state.Value.Frequencies
                         .Agg(aggregations.First(),
                              aggregations.Skip(1).ToArray())
                         .Collect()
                         .FirstOrDefault();

            return(FromAggregationResult(result, 0));
        }
コード例 #3
0
 /// <summary>
 /// Converts an <see cref="Exception"/> to a <see cref="DoubleMetric"/>.
 /// </summary>
 /// <param name="exception">The exception to convert into <see cref="DoubleMetric"/>.</param>
 /// <returns>The instance of type <see cref="DoubleMetric"/>  that represents the exception.</returns>
 public override DoubleMetric ToFailureMetric(Exception exception) =>
 AnalyzersExt.MetricFromFailure(exception, Name, string.Join(',', Columns),
                                AnalyzersExt.EntityFrom(Columns));
コード例 #4
0
 /// <summary>
 /// Converts a value to a <see cref="DoubleMetric"/>.
 /// </summary>
 /// <param name="value">The value to convert into <see cref="DoubleMetric"/>.</param>
 /// <returns>The instance of type <see cref="DoubleMetric"/> that represents the value.</returns>
 protected DoubleMetric ToSuccessMetric(double value) =>
 AnalyzersExt.MetricFromValue(value, Name, string.Join(',', Columns),
                              AnalyzersExt.EntityFrom(Columns));