コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AnalysisProcessingStringValueAggregator"/> class.
 /// </summary>
 /// <param name="valueOptions">Value.AnalysisValueFunction options</param>
 public AnalysisProcessingStringValueAggregator(AnalysisValueOptions valueOptions)
 {
     this.valueOptions = valueOptions;
     this.Delimiter    = !string.IsNullOrEmpty(this.valueOptions.Concatenate) ? valueOptions.Concatenate : ",";
 }
        /// <summary>
        /// Executes computation step
        /// </summary>
        /// <returns>Boolean value for execute computation step</returns>
        public override bool ExecuteComputationStep()
        {
            this.complete = true;
            int i, objectCount = this.objectValues.Count, xObjectCount = this.xObjectValues.Count;

            for (i = 0; i < objectCount; i++)
            {
                AnalysisValueIntermediateResult result = this.objectValues[i] as AnalysisValueIntermediateResult;
                if (!result.Complete)
                {
                    result = result.ExecuteStep();
                    this.objectValues[i] = result;
                    if (!result.Complete)
                    {
                        this.complete = false;
                    }
                }
            }

            for (i = 0; i < xObjectCount; i++)
            {
                AnalysisValueIntermediateResult result = this.xObjectValues[i] as AnalysisValueIntermediateResult;
                if (!result.Complete)
                {
                    result = result.ExecuteStep();
                    this.xObjectValues[i] = result;
                    if (!result.Complete)
                    {
                        this.complete = false;
                    }
                }
            }

            if (this.complete)
            {
                AnalysisValueOptions valueOptions = this.ProcessingResultColumn.ResultColumn.ValueOptions;
                if (objectCount > 0)
                {
                    if (valueOptions.IsStatic && this.objectValues.Count > 1)
                    {
                        this.objectValues = new List <object> {
                            this.objectValues[0]
                        };
                    }

                    if (valueOptions.IsText)
                    {
                        foreach (AnalysisValueIntermediateResult result in this.objectValues)
                        {
                            this.AddStringValue(result.TextResult);
                        }
                    }
                    else
                    {
                        foreach (AnalysisValueIntermediateResult result in this.objectValues)
                        {
                            this.AddDoubleValue(result.NumberResult);
                        }
                    }
                }

                if (xObjectCount > 0)
                {
                    if (valueOptions.IsStatic && this.xObjectValues.Count > 1)
                    {
                        var resultPerXCategory = new Dictionary <string, object>();
                        foreach (AnalysisValueIntermediateResult res in this.xObjectValues)
                        {
                            if (res.XCategoryKey == null)
                            {
                                continue;
                            }

                            resultPerXCategory.SetObjectForKey(res, res.XCategoryKey);
                        }

                        this.xObjectValues = new List <object>(resultPerXCategory.Values);
                    }

                    if (valueOptions.IsText)
                    {
                        foreach (AnalysisValueIntermediateResult result in this.xObjectValues)
                        {
                            this.AddStringValueXCategoryKey(result.TextResult, result.XCategoryKey);
                        }
                    }
                    else
                    {
                        foreach (AnalysisValueIntermediateResult result in this.xObjectValues)
                        {
                            this.AddDoubleValueXCategoryKey(result.NumberResult, result.XCategoryKey);
                        }
                    }
                }
            }

            return(this.complete);
        }