private bool SetAnalyses(LCA1Stock lca1Stock, List <Calculator1> calcs) { bool bHasAnalysis = false; bool bHasTotals = false; //only the totStocks are used in results //calcs holds a collection of lca1stocks for each input and output //object model is calc.Total1.SubPrice1Stocks foreach (Calculator1 calc in calcs) { if (calc.GetType().Equals(lca1Stock.GetType())) { LCA1Stock stock = (LCA1Stock)calc; if (stock != null) { if (stock.Total1 != null) { //calc holds an input or output stock //add that stock to lca1stock (some analyses will need to use subprices too) bHasTotals = AddSubTotalToTotalStock(lca1Stock.Total1, stock.Multiplier, stock.Total1); if (bHasTotals) { bHasAnalysis = true; } } } } } return(bHasAnalysis); }
//run the analyses for inputs an outputs public bool RunAnalyses(LCA1Stock lca1Stock) { bool bHasAnalyses = false; //add totals to lca stocks ( bHasAnalyses = SetAnalyses(lca1Stock); return(bHasAnalyses); }
private bool SetAnalyses(LCA1Stock lca1Stock) { bool bHasAnalysis = false; bool bHasTotals = false; bool adjustTotals = true; //only the totStocks are used to store numerical results //calcprops and analyzerprops stored in lca1stock lca1Stock.Total1 = new LCA1Total1(); //need one property set lca1Stock.Total1.SubApplicationType = lca1Stock.CalcParameters.SubApplicationType.ToString(); //these are the lcc and lcb calculations //the initial aggregation must have serialized them correctly as lcc or lcb calcors //costs foreach (SubPrice1 ind in lca1Stock.SubP1Stock.SubPrice1s) { if (ind.CalculatorType == LCA1CalculatorHelper.CALCULATOR_TYPES.buildcost1.ToString()) { LCC1Calculator lccInput = (LCC1Calculator)ind; //ind.SubPrice1s holds the subprices collection (which must also be totaled) bHasTotals = AddCostToTotalStock(lca1Stock.Total1, lca1Stock.Multiplier, lccInput, adjustTotals); //stock needs some calculator properties (date) BILCA1StockAnalyzer.CopyBaseElementProperties(lccInput.LCCInput, lca1Stock); lca1Stock.Date = lccInput.LCCInput.Date; if (bHasTotals) { bHasAnalysis = true; } } } //benefits foreach (SubPrice1 ind in lca1Stock.SubP2Stock.SubPrice1s) { if (ind.CalculatorType == LCA1CalculatorHelper.CALCULATOR_TYPES.buildbenefit1.ToString()) { LCB1Calculator lcbOutput = (LCB1Calculator)ind; //ind.SubPrice1s holds the subprices collection (which must also be totaled) bHasTotals = AddBenefitToTotalStock(lca1Stock.Total1, lca1Stock.Multiplier, lcbOutput, adjustTotals); //stock needs some calculator properties (date) BILCA1StockAnalyzer.CopyBaseElementProperties(lcbOutput.LCBOutput, lca1Stock); //lca1Stock.Date = lcbOutput.LCBOutput.Date; if (bHasTotals) { bHasAnalysis = true; } } } return(bHasAnalysis); }
//run the analyes for everything else //descendentstock holds input and output stock totals and calculators public bool RunAnalyses(LCA1Stock lca1Stock, List <Calculator1> calcs) { bool bHasAnalyses = false; //add totals to lca1stock.Total1 if (lca1Stock.Total1 == null) { lca1Stock.Total1 = new LCA1Total1(); } //need one property set lca1Stock.Total1.SubApplicationType = lca1Stock.CalcParameters.SubApplicationType.ToString(); bHasAnalyses = SetAnalyses(lca1Stock, calcs); return(bHasAnalyses); }
public virtual void CopyTotalLCA1StocksProperties( LCA1Stock calculator) { if (this.AnalyzerType == LCA1AnalyzerHelper.ANALYZER_TYPES.lcastat1.ToString()) { this.Stat1 = new LCA1Stat1(); this.CopyCalculatorProperties(calculator); this.Stat1.CopyCalculatorProperties(calculator.Stat1); this.Stat1.CopyTotalLCA1Stat1Properties( this.Stat1, calculator.Stat1); } else if (this.AnalyzerType == LCA1AnalyzerHelper.ANALYZER_TYPES.lcachangeyr.ToString() || this.AnalyzerType == LCA1AnalyzerHelper.ANALYZER_TYPES.lcachangeid.ToString() || this.AnalyzerType == LCA1AnalyzerHelper.ANALYZER_TYPES.lcachangealt.ToString()) { this.Change1 = new LCA1Change1(); this.CopyCalculatorProperties(calculator); this.Change1.CopyCalculatorProperties(calculator.Change1); this.Change1.CopyTotalLCA1Change1Properties( this.Change1, calculator.Change1); } else if (this.AnalyzerType == LCA1AnalyzerHelper.ANALYZER_TYPES.lcaprogress1.ToString()) { this.Progress1 = new LCA1Progress1(); this.CopyCalculatorProperties(calculator); this.Progress1.CopyCalculatorProperties(calculator.Progress1); this.Progress1.CopyTotalLCA1Progress1Properties( this.Progress1, calculator.Progress1); } else { //this handles subobjects (calparams, subp1stock, subp2stock) this.Total1 = new LCA1Total1(); this.CopyCalculatorProperties(calculator); this.Total1.CopyCalculatorProperties(calculator.Total1); this.Total1.CopyTotalLCA1Total1Properties( this.Total1, calculator.Total1); } }
//copy constructor public LCA1Stock(LCA1Stock calculator) { CopyTotalLCA1StocksProperties(calculator); }