Exemplo n.º 1
0
 //set up benefit and cost collections that can then be
 //analyzed by basic statistical analyzers (mean, sd, median)
 public virtual void SetBasicCollections(XElement currentElement)
 {
     //need to parse an attribute name in a componly analysis
     this.CalcParams.AnalyzerParms.FilePositionIndex = 0;
     //set the benefits and costs collections
     if (this.CalcParams.AnalyzerParms.NodeName
         .EndsWith(Outcome.OUTCOME_PRICE_TYPES.outcome.ToString()))
     {
         this.CalcParams.AnalyzerParms.BenefitObjectsCount += 1;
         this.CalcParams.AnalyzerParms.NodePositionIndex
             = this.CalcParams.AnalyzerParms.BenefitObjectsCount - 1;
         CostBenefitStatistic01 baseStat = new CostBenefitStatistic01();
         baseStat.SetCalculatorProperties(currentElement);
         baseStat.SetStatisticGeneralProperties(currentElement);
         //set the "All" column (holds sum of all outputs)
         AddBenefitStatisticsToDictionary(
             this.CalcParams.AnalyzerParms.FilePositionIndex,
             this.CalcParams.AnalyzerParms.NodePositionIndex, baseStat);
     }
     else
     {
         this.CalcParams.AnalyzerParms.CostObjectsCount += 1;
         this.CalcParams.AnalyzerParms.NodePositionIndex
             = this.CalcParams.AnalyzerParms.CostObjectsCount - 1;
         CostBenefitStatistic01 baseStat = new CostBenefitStatistic01();
         baseStat.SetCalculatorProperties(currentElement);
         baseStat.SetStatisticGeneralProperties(currentElement);
         //need a new coststat object for each output object
         AddCostStatisticsToDictionary(
             this.CalcParams.AnalyzerParms.FilePositionIndex,
             this.CalcParams.AnalyzerParms.NodePositionIndex, baseStat);
     }
 }
Exemplo n.º 2
0
 //set up benefit and cost collections that can then be
 //analyzed by effectiveness analyzers (cost per unit output)
 public virtual void SetOutputBasedCollections(XElement currentElement)
 {
     //need to parse an attribute name in a componly analysis
     this.CalcParams.AnalyzerParms.FilePositionIndex = 0;
     //set the benefits and costs collections (basestats.count = outputs.count)
     if (this.CalcParams.AnalyzerParms.NodeName
         .EndsWith(Outcome.OUTCOME_PRICE_TYPES.outcome.ToString()))
     {
         //two attributes are used to set the benefits and costs collections
         //the benefits count must be set before the costs collection,
         //so the order that the nodes get streamed is critical
         if (this.CalcParams.AnalyzerParms.BenefitObjectsCount == 0)
         {
             this.CalcParams.AnalyzerParms.BenefitObjectsCount += 1;
             this.CalcParams.AnalyzerParms.NodePositionIndex
                 = this.CalcParams.AnalyzerParms.BenefitObjectsCount - 1;
             //first output is the "All" column holding summation of outputs
             CostBenefitStatistic01 baseAllStat = new CostBenefitStatistic01();
             baseAllStat.SetCalculatorProperties(currentElement);
             //the all column's stats will be a summation of outputs and
             //get set after the Benefits collection has been filled
             baseAllStat.SetStatisticGeneralProperties(currentElement);
             //set the "All" column (holds sum of all outputs)
             AddBenefitStatisticsToDictionary(
                 this.CalcParams.AnalyzerParms.FilePositionIndex, this.CalcParams.AnalyzerParms.NodePositionIndex,
                 baseAllStat);
         }
         //this is not a conditional clause
         //set the first output column
         this.CalcParams.AnalyzerParms.BenefitObjectsCount += 1;
         this.CalcParams.AnalyzerParms.NodePositionIndex
             = this.CalcParams.AnalyzerParms.BenefitObjectsCount - 1;
         CostBenefitStatistic01 baseStat = new CostBenefitStatistic01();
         //set totals
         baseStat.SetCalculatorProperties(currentElement);
         //set statistics
         baseStat.SetStatisticGeneralProperties(currentElement);
         baseStat.SetMeanBenefitsProperties(currentElement);
         baseStat.SetMedianBenefitsProperties(currentElement);
         baseStat.SetNBenefitsProperties(currentElement);
         baseStat.SetStdDevBenefitsProperties(currentElement);
         //convert app names to stat names
         SetNameProperties(baseStat, currentElement);
         //set the "All" column (holds sum of all outputs)
         AddBenefitStatisticsToDictionary(
             this.CalcParams.AnalyzerParms.FilePositionIndex, this.CalcParams.AnalyzerParms.NodePositionIndex,
             baseStat);
     }
     else
     {
         this.CalcParams.AnalyzerParms.CostObjectsCount += 1;
         this.CalcParams.AnalyzerParms.NodePositionIndex
             = this.CalcParams.AnalyzerParms.CostObjectsCount - 1;
         //ce analyses use the benefitsobject count to set
         //the zero-based number of nodes
         for (int i = 0; i <= this.CalcParams.AnalyzerParms.BenefitObjectsCount - 1; i++)
         {
             CostBenefitStatistic01 baseStat = new CostBenefitStatistic01();
             baseStat.SetCalculatorProperties(currentElement);
             baseStat.SetStatisticGeneralProperties(currentElement);
             //need a new coststat object for each output object
             AddCostStatisticsToDictionary(
                 this.CalcParams.AnalyzerParms.FilePositionIndex, i, baseStat);
         }
     }
 }