private void AddAncestorObjects(XElement currentElement)
        {
            XElement currentCalculationsElement = null;

            currentCalculationsElement
                = CalculatorHelpers.GetCalculator(this.GCCalculatorParams,
                                                  currentElement);
            if (currentElement.Name.LocalName
                .EndsWith(Outcome.OUTCOME_PRICE_TYPES.outcome.ToString()))
            {
                //need the oc.amount multiplier at the input level (so set the parentopcomp here)
                this.GCCalculatorParams.ParentOutcome
                    = new Outcome();
                this.GCCalculatorParams.ParentOutcome
                .SetOutcomeProperties(
                    this.GCCalculatorParams, currentCalculationsElement,
                    currentElement);
                //init the total costs to zero
                this.GCCalculatorParams.ParentOutcome.InitTotalCostsProperties();
                //all calculators need it
                if (this.HCStockCalculator != null)
                {
                    this.HCStockCalculator.BIHC1Calculator.GCCalculatorParams.ParentOutcome
                        = this.GCCalculatorParams.ParentOutcome;
                }
            }
        }
Example #2
0
        private void AddAncestorObjects(XElement currentElement)
        {
            XElement currentCalculationsElement = null;

            currentCalculationsElement
                = CalculatorHelpers.GetCalculator(this.GCCalculatorParams,
                                                  currentElement);
            if (currentElement.Name.LocalName
                .EndsWith(OperationComponent.OPERATION_PRICE_TYPES.operation.ToString()) ||
                currentElement.Name.LocalName
                .EndsWith(OperationComponent.COMPONENT_PRICE_TYPES.component.ToString()))
            {
                //need the oc.amount multiplier at the input level (so set the parentopcomp here)
                this.GCCalculatorParams.ParentOperationComponent
                    = new OperationComponent();
                this.GCCalculatorParams.ParentOperationComponent
                .SetOperationComponentProperties(
                    this.GCCalculatorParams, currentCalculationsElement,
                    currentElement);
                //init the total costs to zero
                this.GCCalculatorParams.ParentOperationComponent.InitTotalCostsProperties();
                //all calculators need it
                if (this.FNStockCalculator != null)
                {
                    this.FNStockCalculator.BIFN1Calculator.GCCalculatorParams.ParentOperationComponent
                        = this.GCCalculatorParams.ParentOperationComponent;
                }
                else if (this.FNSR01StockCalculator != null)
                {
                    this.FNSR01StockCalculator.BIFNSR01Calculator.GCCalculatorParams.ParentOperationComponent
                        = this.GCCalculatorParams.ParentOperationComponent;
                }
            }
        }
Example #3
0
        private bool RunBasicCalculationsAndSetUpdates(ref XElement currentElement)
        {
            bool bHasCalculations = false;

            if (!currentElement.HasAttributes)
            {
                return(true);
            }
            //1. set parameters needed by updates collection
            this.GCCalculatorParams.CurrentElementNodeName
                = currentElement.Name.LocalName;
            this.GCCalculatorParams.CurrentElementURIPattern
                = CalculatorHelpers.MakeNewURIPatternFromElement(this.GCCalculatorParams.ExtensionDocToCalcURI.URIPattern,
                                                                 currentElement);
            //2. don't run calcs on ancestors
            bool bIsSelfOrDescendentNode = CalculatorHelpers.IsSelfOrDescendentNode(
                this.GCCalculatorParams, this.GCCalculatorParams.CurrentElementNodeName);

            if (bIsSelfOrDescendentNode)
            {
                //3. get the calculator to use
                //(this.GCCalculatorParams.CalculationEl, or currentElement.xmldoc)
                XElement linkedViewElement = null;
                linkedViewElement = CalculatorHelpers.GetCalculator(
                    this.GCCalculatorParams, currentElement);
                //some apps, such as locals, work differently
                AdjustSpecialtyLinkedViewElements(currentElement, ref linkedViewElement);
                //4. Set bool to update base node attributes in db
                this.GCCalculatorParams.AttributeNeedsDbUpdate
                    = CalculatorHelpers.NeedsUpdateAttribute(this.GCCalculatorParams);
                //5. raise event to carry out calculations
                GCArguments.CurrentElement    = currentElement;
                GCArguments.LinkedViewElement = linkedViewElement;
                OnRunCalculation(GCArguments);
                currentElement    = GCArguments.CurrentElement;
                linkedViewElement = GCArguments.LinkedViewElement;
                bHasCalculations  = GCArguments.HasCalculations;
                if (bHasCalculations)
                {
                    //6. 100% Rules: don't allow analyzers to db update descendent calculators
                    ChangeLinkedViewCalculator(currentElement, ref linkedViewElement);
                    //7. replace the this.GCCalculatorParams.LinkedViewElement when
                    //the originating doctocalcuri node is processed
                    bool bHasReplacedCalculator = CalculatorHelpers.ReplaceCalculations(this.GCCalculatorParams,
                                                                                        currentElement, linkedViewElement);
                    //8. SetXmlDocAttributes
                    CalculatorHelpers.SetXmlDocUpdates(this.GCCalculatorParams,
                                                       linkedViewElement, ref currentElement,
                                                       this.GCCalculatorParams.Updates);
                }
            }
            else
            {
                //basic calculators don't need full collections that include ancestors
                bHasCalculations = true;
            }
            return(bHasCalculations);
        }
        //doesn't run analysis yet; just fills in stateful model for object analysis
        private async Task <bool> RunBasicAnalysisAndSetUpdates(XElement currentElement)
        {
            bool bHasCalculations = false;

            if (!currentElement.HasAttributes)
            {
                return(true);
            }
            //1. set parameters needed by updates collection
            this.GCCalculatorParams.CurrentElementNodeName
                = currentElement.Name.LocalName;
            this.GCCalculatorParams.CurrentElementURIPattern
                = CalculatorHelpers.MakeNewURIPatternFromElement(this.GCCalculatorParams.ExtensionDocToCalcURI.URIPattern,
                                                                 currentElement);
            //2. don't run calcs on ancestors
            bool bIsSelfOrDescendentNode = CalculatorHelpers.IsSelfOrDescendentNode(
                this.GCCalculatorParams, this.GCCalculatorParams.CurrentElementNodeName);

            if (bIsSelfOrDescendentNode)
            {
                //3. get the calculator to use
                //(this.GCCalculatorParams.CalculationEl, or currentElement.xmldoc)
                XElement linkedViewElement = null;
                linkedViewElement = CalculatorHelpers.GetCalculator(
                    this.GCCalculatorParams, currentElement);
                //4. Set bool to update base node attributes in db
                this.GCCalculatorParams.AttributeNeedsDbUpdate
                    = CalculatorHelpers.NeedsUpdateAttribute(this.GCCalculatorParams);
                //5. raise event to carry out analysis (no tasks, just property manipulation)
                bHasCalculations = await SetAnalysisModel(currentElement, linkedViewElement);

                if (bHasCalculations)
                {
                    //6. allow analyzers to db update descendent analyzers
                    CalculatorHelpers.ChangeLinkedViewCalculatorForAnalysis(this.GCCalculatorParams, currentElement, ref linkedViewElement);
                    //7. replace the this.GCCalculatorParams.LinkedViewElement when
                    //the originating doctocalcuri node is processed
                    bool bHasReplacedCalculator = CalculatorHelpers.ReplaceCalculations(this.GCCalculatorParams,
                                                                                        currentElement, linkedViewElement);
                    //8. SetXmlDocAttributes
                    CalculatorHelpers.SetXmlDocUpdates(this.GCCalculatorParams,
                                                       linkedViewElement, ref currentElement,
                                                       this.GCCalculatorParams.Updates);
                }
            }
            else
            {
                XElement linkedViewElement = null;
                bHasCalculations = await SetAnalysisModel(currentElement, linkedViewElement);

                //always return true, so no error msg is generated
                bHasCalculations = true;
            }
            return(bHasCalculations);
        }
 //descendents need properties from ancestor objects (i.e. realrate)
 //to run their calculations, the ancestors are kept statefully in this.GCCalculatorParams
 private void AddAncestorObjects(XElement currentElement)
 {
     if (currentElement.Name.LocalName
         .EndsWith(Outcome.OUTCOME_PRICE_TYPES.outcome.ToString()))
     {
         XElement currentCalculationsElement
             = CalculatorHelpers.GetCalculator(this.GCCalculatorParams,
                                               currentElement);
         SetAncestorProperties(currentElement, currentCalculationsElement);
         //run joint output calculations (i.e. fuel amount, fuel cost)
         //these will be copied to descendent output nodes as calculations are run
         //on those nodes
         NPVOutcomeCalculator outcomeCalculator = new NPVOutcomeCalculator();
         outcomeCalculator.SetJointOutputCalculations(
             this.GCCalculatorParams);
     }
 }
Example #6
0
 //descendents need properties from ancestor objects (i.e. realrate)
 //to run their calculations, the ancestors are kept statefully in this.GCCalculatorParams
 private void AddAncestorObjects(XElement currentElement)
 {
     if (currentElement.Name.LocalName
         .EndsWith(OperationComponent.OPERATION_PRICE_TYPES.operation.ToString()) ||
         currentElement.Name.LocalName
         .EndsWith(OperationComponent.COMPONENT_PRICE_TYPES.component.ToString()))
     {
         XElement currentCalculationsElement
             = CalculatorHelpers.GetCalculator(this.GCCalculatorParams,
                                               currentElement);
         SetAncestorProperties(currentElement, currentCalculationsElement);
         //run joint input calculations (i.e. fuel amount, fuel cost)
         //these will be copied to descendent input nodes as calculations are run
         //on those nodes
         OCCalculator ocCalculator = new OCCalculator();
         ocCalculator.SetJointInputCalculations(
             this.GCCalculatorParams);
     }
 }
        private async Task <bool> RunBasicCalculationsAndSetUpdatesAsync(XElement currentElement)
        {
            bool bHasCalculations = false;

            if (!currentElement.HasAttributes)
            {
                return(true);
            }
            //1. set parameters needed by updates collection
            this.GCCalculatorParams.CurrentElementNodeName
                = currentElement.Name.LocalName;
            this.GCCalculatorParams.CurrentElementURIPattern
                = CalculatorHelpers.MakeNewURIPatternFromElement(this.GCCalculatorParams.ExtensionDocToCalcURI.URIPattern,
                                                                 currentElement);
            //2. don't run calcs on ancestors
            bool bIsSelfOrDescendentNode = CalculatorHelpers.IsSelfOrDescendentNode(
                this.GCCalculatorParams, this.GCCalculatorParams.CurrentElementNodeName);

            if (bIsSelfOrDescendentNode)
            {
                //3. get the calculator to use
                //(this.GCCalculatorParams.CalculationEl, or currentElement.xmldoc)
                XElement linkedViewElement = null;
                linkedViewElement = CalculatorHelpers.GetCalculator(
                    this.GCCalculatorParams, currentElement);
                //some apps, such as locals, work differently
                CalculatorHelpers.AdjustSpecialtyLinkedViewElements(currentElement, linkedViewElement, this.GCCalculatorParams);
                //4. Set bool to update base node attributes in db
                this.GCCalculatorParams.AttributeNeedsDbUpdate
                    = CalculatorHelpers.NeedsUpdateAttribute(this.GCCalculatorParams);
                //5. raise event to carry out calculations
                //v180: no children xml doc changes when Overwrite = false and UseSameCalc = false
                bool bNeedsLVUpdate = CalculatorHelpers.NeedsLVUpdate(this.GCCalculatorParams);
                if (bNeedsLVUpdate)
                {
                    bHasCalculations
                        = await RunCalculationAsync(currentElement, linkedViewElement);
                }
                else
                {
                    //but if it's a child it might still need to be displayed
                    //will only be displayed by setting CalculatorId or AnalyzerType in currentEl
                    if (CalculatorHelpers.IsSelfOrChildNode(this.GCCalculatorParams, this.GCCalculatorParams.CurrentElementNodeName))
                    {
                        CalculatorHelpers.SetCalculatorId(linkedViewElement, currentElement);
                    }
                }
                if (bHasCalculations)
                {
                    //v182 added resetting because async starts next node (i.e. parent) and these change before the method is finished
                    //1. set parameters needed by updates collection
                    //this.GCCalculatorParams.CurrentElementNodeName
                    //    = currentElement.Name.LocalName;
                    //this.GCCalculatorParams.CurrentElementURIPattern
                    //    = CalculatorHelpers.MakeNewURIPatternFromElement(this.GCCalculatorParams.ExtensionDocToCalcURI.URIPattern,
                    //    currentElement);
                    //6. 100% Rules: don't allow analyzers to db update descendent calculators
                    CalculatorHelpers.ChangeLinkedViewCalculator(currentElement, linkedViewElement, this.GCCalculatorParams);
                    //7. replace the this.GCCalculatorParams.LinkedViewElement when
                    //the originating doctocalcuri node is processed
                    bool bHasReplacedCalculator = CalculatorHelpers.ReplaceCalculations(this.GCCalculatorParams,
                                                                                        currentElement, linkedViewElement);
                    //8. v180 SetXmlDocAttributes only set db updates (xmldoc lvs are automatically changed by RunCalcAsync)
                    CalculatorHelpers.SetXmlDocUpdates(this.GCCalculatorParams,
                                                       linkedViewElement, currentElement, this.GCCalculatorParams.Updates);
                }
            }
            else
            {
                //basic calculators don't need full collections that include ancestobrs
                bHasCalculations = true;
            }
            return(bHasCalculations);
        }
        //only tps are needed by descendants using this event
        private void AddAncestorObjects(XElement currentElement)
        {
            XElement currentCalculationsElement = null;

            currentCalculationsElement
                = CalculatorHelpers.GetCalculator(this.GCCalculatorParams,
                                                  currentElement);
            if (currentElement.Name.LocalName
                == BudgetInvestment.BUDGET_TYPES.budgettimeperiod.ToString() ||
                currentElement.Name.LocalName
                == BudgetInvestment.INVESTMENT_TYPES.investmenttimeperiod.ToString())
            {
                //need the tp.amount multiplier
                //set the stateful ancestor object
                //last time period date's are used in some calculations
                DateTime dtLastTimePeriodDate = new DateTime(1000, 12, 1);
                bool     bHasLastDate         = false;
                if (this.GCCalculatorParams.ParentTimePeriod != null)
                {
                    bHasLastDate         = true;
                    dtLastTimePeriodDate = this.GCCalculatorParams.ParentTimePeriod.Date;
                }
                this.GCCalculatorParams.ParentTimePeriod = new TimePeriod();
                //deserialize xml to object, just need the amount, maybe date
                this.GCCalculatorParams.ParentTimePeriod.SetTimePeriodProperties(
                    this.GCCalculatorParams, currentCalculationsElement, currentElement);
                //copy some of the last tps properties to current tp
                if (!bHasLastDate)
                {
                    dtLastTimePeriodDate
                        = this.GCCalculatorParams.ParentTimePeriod.Date;
                }
                this.GCCalculatorParams.ParentTimePeriod.LastPeriodDate
                    = dtLastTimePeriodDate;
                //all calculators need it
                if (this.BIHC1Calculator != null)
                {
                    this.BIHC1Calculator.GCCalculatorParams.ParentTimePeriod
                        = this.GCCalculatorParams.ParentTimePeriod;
                }
            }
            else if (currentElement.Name.LocalName
                     .EndsWith(OperationComponent.OPERATION_PRICE_TYPES.operation.ToString()) ||
                     currentElement.Name.LocalName
                     .EndsWith(OperationComponent.COMPONENT_PRICE_TYPES.component.ToString()))
            {
                //need the oc.amount multiplier
                this.GCCalculatorParams.ParentOperationComponent
                    = new OperationComponent();
                this.GCCalculatorParams.ParentOperationComponent
                .SetOperationComponentProperties(
                    this.GCCalculatorParams, currentCalculationsElement,
                    currentElement);
                //init the total costs to zero
                this.GCCalculatorParams.ParentOperationComponent.InitTotalCostsProperties();
                //all calculators need it
                if (this.BIHC1Calculator != null)
                {
                    this.BIHC1Calculator.GCCalculatorParams.ParentOperationComponent
                        = this.GCCalculatorParams.ParentOperationComponent;
                }
            }
            else if (currentElement.Name.LocalName
                     .EndsWith(Outcome.OUTCOME_PRICE_TYPES.outcome.ToString()))
            {
                //need the ooutcome.amount multiplier
                this.GCCalculatorParams.ParentOutcome
                    = new Outcome();
                this.GCCalculatorParams.ParentOutcome
                .SetOutcomeProperties(
                    this.GCCalculatorParams, currentCalculationsElement,
                    currentElement);
                //init the total costs to zero
                this.GCCalculatorParams.ParentOutcome.InitTotalBenefitsProperties();
                //all calculators need it
                if (this.BIHC1Calculator != null)
                {
                    this.BIHC1Calculator.GCCalculatorParams.ParentOutcome
                        = this.GCCalculatorParams.ParentOutcome;
                }
            }
        }
Example #9
0
        private bool RunIOTechCalculationsAndSetUpdates(ref XElement currentElement)
        {
            bool bHasCalculations = false;

            if (!currentElement.HasAttributes)
            {
                return(true);
            }
            //1. set parameters needed by updates collection
            this.GCCalculatorParams.CurrentElementNodeName
                = currentElement.Name.LocalName;
            this.GCCalculatorParams.CurrentElementURIPattern
                = CalculatorHelpers.MakeNewURIPatternFromElement(this.GCCalculatorParams.ExtensionDocToCalcURI.URIPattern,
                                                                 currentElement);
            //2. don't run calcs on ancestors
            bool bIsSelfOrDescendentNode = CalculatorHelpers.IsSelfOrDescendentNode(
                this.GCCalculatorParams, this.GCCalculatorParams.CurrentElementNodeName);

            if (bIsSelfOrDescendentNode)
            {
                //3. get the calculator to use
                //(this.GCCalculatorParams.CalculationEl, or currentElement.xmldoc)
                XElement linkedViewElement       = null;
                bool     bNeedsRelatedCalculator = NeedsRelatedCalculator();
                if (bNeedsRelatedCalculator)
                {
                    //no db updates -potential to continually have to update in/outs in db
                    linkedViewElement
                        = CalculatorHelpers.GetRelatedCalculator(this.GCCalculatorParams,
                                                                 currentElement);
                }
                else
                {
                    //don't use calctype = input; prefer using stronger relatedcalctype=agmachinery
                    string sCalculatorType = this.GCCalculatorParams.CalculatorType;
                    this.GCCalculatorParams.CalculatorType = string.Empty;
                    linkedViewElement
                        = CalculatorHelpers.GetCalculator(this.GCCalculatorParams,
                                                          currentElement);
                    this.GCCalculatorParams.CalculatorType = sCalculatorType;
                }
                //4. Set bool to update base node attributes in db
                this.GCCalculatorParams.AttributeNeedsDbUpdate
                    = CalculatorHelpers.NeedsUpdateAttribute(this.GCCalculatorParams);
                //5. raise event to carry out calculations
                GCArguments.CurrentElement    = currentElement;
                GCArguments.LinkedViewElement = linkedViewElement;
                OnRunCalculation(GCArguments);
                currentElement    = GCArguments.CurrentElement;
                linkedViewElement = GCArguments.LinkedViewElement;
                bHasCalculations  = GCArguments.HasCalculations;
                //6. 100% Rules: don't allow analyzers to db update descendent calculators
                ChangeLinkedViewCalculator(currentElement, ref linkedViewElement);
                //inputs have a join-side xmldoc that may need to be updated
                //to current calculator results (i.e. Input.Times can change
                //the amount of fuel, labor, and other resources for this input)
                //note that the base npvcalculator does not always adjust
                //resource calculator amounts, such as fuel and labor, when
                //Input.Times change (if it did, the following would not be needed).
                if (CalculatorHelpers.IsLinkedViewXmlDoc(
                        this.GCCalculatorParams.CurrentElementURIPattern,
                        this.GCCalculatorParams.ExtensionDocToCalcURI))
                {
                    //7. replace the this.GCCalculatorParams.CalculationsElement when
                    //the originating doctocalcuri node is processed
                    bool bHasReplacedCalculator = CalculatorHelpers.ReplaceCalculations(
                        this.GCCalculatorParams, currentElement,
                        linkedViewElement);
                    //8. this pattern combines analyzer and calculator patterns
                    CalculatorHelpers.SetAnalyzerParameters(
                        this.GCCalculatorParams, linkedViewElement);
                }
                //9. SetXmlDocAttributes
                CalculatorHelpers.SetXmlDocUpdates(this.GCCalculatorParams,
                                                   linkedViewElement, ref currentElement,
                                                   this.GCCalculatorParams.Updates);
            }
            else
            {
                //version 1.3.0 added this so that ancestors are always added to collections
                //to make analyses consistent (i.e. always start with group)
                GCArguments.CurrentElement = currentElement;
                //ancestors can never update or use a linkedview element
                GCArguments.LinkedViewElement = null;
                //but we want the ancestor current element added to the underlying collections
                OnRunCalculation(GCArguments);
                //always return true, so no error msg is generated
                bHasCalculations = true;
            }
            return(bHasCalculations);
        }
Example #10
0
        private bool RunBasicAnalysisAndSetUpdates(ref XElement currentElement)
        {
            bool bHasCalculations = false;

            if (!currentElement.HasAttributes)
            {
                return(true);
            }
            //1. set parameters needed by updates collection
            this.GCCalculatorParams.CurrentElementNodeName
                = currentElement.Name.LocalName;
            this.GCCalculatorParams.CurrentElementURIPattern
                = CalculatorHelpers.MakeNewURIPatternFromElement(this.GCCalculatorParams.ExtensionDocToCalcURI.URIPattern,
                                                                 currentElement);
            //2. don't run calcs on ancestors
            bool bIsSelfOrDescendentNode = CalculatorHelpers.IsSelfOrDescendentNode(
                this.GCCalculatorParams, this.GCCalculatorParams.CurrentElementNodeName);

            if (bIsSelfOrDescendentNode)
            {
                //3. get the calculator to use
                //(this.GCCalculatorParams.CalculationEl, or currentElement.xmldoc)
                XElement linkedViewElement = null;
                linkedViewElement = CalculatorHelpers.GetCalculator(
                    this.GCCalculatorParams, currentElement);
                //4. Set bool to update base node attributes in db
                this.GCCalculatorParams.AttributeNeedsDbUpdate
                    = CalculatorHelpers.NeedsUpdateAttribute(this.GCCalculatorParams);
                //5. raise event to carry out calculations
                GCArguments.CurrentElement    = currentElement;
                GCArguments.LinkedViewElement = linkedViewElement;
                OnRunCalculation(GCArguments);
                currentElement = GCArguments.CurrentElement;
                //subscriber sets the lv to update
                linkedViewElement = GCArguments.LinkedViewElement;
                bHasCalculations  = GCArguments.HasCalculations;
                if (bHasCalculations)
                {
                    //6. allow analyzers to db update descendent analyzers
                    CalculatorHelpers.ChangeLinkedViewCalculatorForAnalysis(this.GCCalculatorParams, currentElement,
                                                                            ref linkedViewElement);
                    //7. replace the this.GCCalculatorParams.LinkedViewElement when
                    //the originating doctocalcuri node is processed
                    bool bHasReplacedCalculator = CalculatorHelpers.ReplaceCalculations(this.GCCalculatorParams,
                                                                                        currentElement, linkedViewElement);
                    //8. SetXmlDocAttributes
                    CalculatorHelpers.SetXmlDocUpdates(this.GCCalculatorParams,
                                                       linkedViewElement, ref currentElement,
                                                       this.GCCalculatorParams.Updates);
                }
            }
            else
            {
                //version 1.3.6 added this so that ancestors are always added to collections
                //to make analyses consistent (i.e. always start with group)
                GCArguments.CurrentElement = currentElement;
                //ancestors can never update or use a linkedview element
                GCArguments.LinkedViewElement = null;
                //but we want the ancestor current element added to the underlying collections
                OnRunCalculation(GCArguments);
                //always return true, so no error msg is generated
                bHasCalculations = true;
            }
            return(bHasCalculations);
        }
Example #11
0
        //descendants need properties from ancestor objects (i.e. realrate)
        //to run their calculations; the ancestors are kept statefully in this.GCCalculatorParams
        private void AddAncestorObjects(XElement currentElement)
        {
            XElement currentCalculationsElement = null;

            currentCalculationsElement
                = CalculatorHelpers.GetCalculator(this.GCCalculatorParams,
                                                  currentElement);
            if (currentElement.Name.LocalName
                == BudgetInvestment.BUDGET_TYPES.budgetgroup.ToString() ||
                currentElement.Name.LocalName
                == BudgetInvestment.INVESTMENT_TYPES.investmentgroup.ToString())
            {
                //set the stateful ancestor object
                this.GCCalculatorParams.ParentBudgetInvestmentGroup
                    = new BudgetInvestmentGroup();
                //deserialize xml to object
                this.GCCalculatorParams.ParentBudgetInvestmentGroup.SetBudgetInvestmentGroupProperties(
                    this.GCCalculatorParams, currentCalculationsElement, currentElement);
                //init the total costs to zero
                this.GCCalculatorParams.ParentBudgetInvestmentGroup.InitTotalBenefitsProperties();
                this.GCCalculatorParams.ParentBudgetInvestmentGroup.InitTotalCostsProperties();
            }
            else if (currentElement.Name.LocalName
                     == BudgetInvestment.BUDGET_TYPES.budget.ToString() ||
                     currentElement.Name.LocalName
                     == BudgetInvestment.INVESTMENT_TYPES.investment.ToString())
            {
                //set the stateful ancestor object
                this.GCCalculatorParams.ParentBudgetInvestment
                    = new BudgetInvestment();
                //deserialize xml to object
                this.GCCalculatorParams.ParentBudgetInvestment.SetBudgetInvestmentProperties(
                    this.GCCalculatorParams, currentCalculationsElement, currentElement);
                //init the total costs to zero
                this.GCCalculatorParams.ParentBudgetInvestment.InitTotalBenefitsProperties();
                this.GCCalculatorParams.ParentBudgetInvestment.InitTotalCostsProperties();

                //anyway to setpreprod annuities later rather than running here?
                SetAncestorBudgetInvestment(currentCalculationsElement, currentElement);

                //run preproduction and other annuity calculations
                BICalculator biCalculator = new BICalculator();
                biCalculator.SetPreProductionCalculations(
                    this.GCCalculatorParams, currentElement);
                //reset annuities collection
                this.GCCalculatorParams.ParentBudgetInvestment.AnnEquivalents = null;
            }
            else if (currentElement.Name.LocalName
                     == BudgetInvestment.BUDGET_TYPES.budgettimeperiod.ToString() ||
                     currentElement.Name.LocalName
                     == BudgetInvestment.INVESTMENT_TYPES.investmenttimeperiod.ToString())
            {
                //set the stateful ancestor object
                //last time period date's are used in some calculations
                DateTime dtLastTimePeriodDate = new DateTime(1000, 12, 1);
                bool     bHasLastDate         = false;
                if (this.GCCalculatorParams.ParentTimePeriod != null)
                {
                    bHasLastDate         = true;
                    dtLastTimePeriodDate = this.GCCalculatorParams.ParentTimePeriod.Date;
                }
                this.GCCalculatorParams.ParentTimePeriod = new TimePeriod();
                //deserialize xml to object
                this.GCCalculatorParams.ParentTimePeriod.SetTimePeriodProperties(
                    this.GCCalculatorParams, currentCalculationsElement, currentElement);
                //init the total costs to zero
                this.GCCalculatorParams.ParentTimePeriod.InitTotalBenefitsProperties();
                this.GCCalculatorParams.ParentTimePeriod.InitTotalCostsProperties();
                if (this.GCCalculatorParams.ParentBudgetInvestment.PreProdPeriods == 0 &&
                    this.GCCalculatorParams.ParentBudgetInvestment.ProdPeriods <= 1)
                {
                    //no preproduction annuities
                    this.GCCalculatorParams.ParentBudgetInvestment.InitEOPDate
                        = this.GCCalculatorParams.ParentTimePeriod.Date;
                }
                //copy some of the last tps properties to current tp
                if (!bHasLastDate)
                {
                    dtLastTimePeriodDate
                        = this.GCCalculatorParams.ParentTimePeriod.Date;
                }
                this.GCCalculatorParams.ParentTimePeriod.LastPeriodDate
                    = dtLastTimePeriodDate;
            }
            else if (currentElement.Name.LocalName
                     .EndsWith(Outcome.OUTCOME_PRICE_TYPES.outcome.ToString()))
            {
                this.GCCalculatorParams.ParentOutcome = new Outcome();
                this.GCCalculatorParams.ParentOutcome.SetOutcomeProperties(
                    this.GCCalculatorParams, currentCalculationsElement, currentElement);
                //init the total costs to zero
                this.GCCalculatorParams.ParentOutcome.InitTotalBenefitsProperties();
                SetAncestorOutcome(currentCalculationsElement, currentElement);
                //run joint output calculations
                //these will be copied to descendant output nodes as calculations
                //are run on those nodes
                NPVOutcomeCalculator outcomeCalculator = new NPVOutcomeCalculator();
                outcomeCalculator.SetJointOutputCalculations(
                    this.GCCalculatorParams);
            }
            else if (currentElement.Name.LocalName
                     .EndsWith(OperationComponent.OPERATION_PRICE_TYPES.operation.ToString()) ||
                     currentElement.Name.LocalName
                     .EndsWith(OperationComponent.COMPONENT_PRICE_TYPES.component.ToString()))
            {
                this.GCCalculatorParams.ParentOperationComponent = new OperationComponent();
                this.GCCalculatorParams.ParentOperationComponent.SetOperationComponentProperties(
                    this.GCCalculatorParams, currentCalculationsElement, currentElement);
                //init the total costs to zero
                this.GCCalculatorParams.ParentOperationComponent.InitTotalCostsProperties();
                SetAncestorOperationComponent(currentCalculationsElement, currentElement);
                //run joint input calculations (i.e. fuel amount, fuel cost)
                //these will be copied to descendant input nodes as calculations
                //are run on those nodes
                OCCalculator ocCalculator = new OCCalculator();
                ocCalculator.SetJointInputCalculations(
                    this.GCCalculatorParams);
            }
        }