Iterator actionsIter = actions.iterator();
Iterator actionsIter;
    private CostBenefitEvaluation createCostBenefitEvaluation(StateEstimation se, CostBenefitKnob knob) {        AssetID assetID = se.getAssetID();        if (logger.isDebugEnabled()) logger.debug("Looking for actions for "+assetID);        CostBenefitEvaluation cbe =                new CostBenefitEvaluation(assetID, knob.getHorizon(), se);        Collection actions = findActionCollection(assetID);        if (logger.isDebugEnabled()) logger.debug("Have "+((actions != null)?actions.size():0)+" actions");        if (logger.isDebugEnabled()) logger.debug("StateEstimation: "+se.toString());        if (actions == null) return cbe; // No actions exist that even possibly apply - usually an initialization situation        Iterator actionsIter = actions.iterator();        // iterate over all applicable Actions for this asset        // compute the expected c-b for each based on StateEstimation        while (actionsIter.hasNext()) {            ActionsWrapper thisActionWrapper = (ActionsWrapper) actionsIter.next();            Action thisAction = thisActionWrapper.getAction();            try {                //call tech spec service & get action tech spec                ActionTechSpecInterface atsi = (ActionTechSpecInterface) actionTechSpecService.getActionTechSpec(thisAction.getClass().getName());                if (atsi == null) {                    throw (new TechSpecNotFoundException( "Cannot find Action Tech Spec for "+ thisAction.getClass().getName() ));                }               if (atsi.getActionType() == ActionTechSpecInterface.CORRECTIVE_ACTIONTYPE) {                    // Which StateDimension does this Action apply to?                    AssetStateDimension asd = atsi.getStateDimension();                    if (logger.isDebugEnabled()) logger.debug("This CORRECTIVE Action: "+thisAction+":"+atsi+":"+asd);                    try {                        // Get the StateDimensionEstimation for the dimension the Action applies to - Throws an exception if SDE not found                        StateDimensionEstimation currentEstimatedStateDimension = se.getStateDimensionEstimation(asd);                        // create the Action container that will hold the evaluations of all offered Variants                        ActionEvaluation thisActionEvaluation = new ActionEvaluation(thisAction);                        cbe.addActionEvaluation(thisActionEvaluation);                        /* Evaluate ALL variants of this Action, not just the ones currently offered                         * Selection will down-select to only the offered variants                         * We compute for all variants because the set of offered variants may change during the process of addressing a problem                         */                        // Get the TechSpec data for all the Variants                        Collection variantDescriptions = atsi.getActions();                        // iterate thru all offered Variants of this Action                        Iterator variantIter = variantDescriptions.iterator();                        while (variantIter.hasNext()) {                            // Get TechSpec for this Variant                            ActionDescription thisVariantDescription = (ActionDescription) variantIter.next();                            // Is this variant active?                            boolean thisVariantActiveP = (thisAction.getValue() != null) && thisAction.getValue().isActive() && thisAction.getValue().getAction().equals(thisVariantDescription.name());                            // Add an entry to the current Action containing the information about this Variant                            thisActionEvaluation.addVariantEvaluation(createCorrectiveVariantEvaluation(assetID, asd, currentEstimatedStateDimension, thisVariantDescription, thisActionEvaluation, thisVariantActiveP, knob));                         }                    }                    catch (BelievabilityException e) {                        logger.error("Cannot find StateDimensionEstimate for "+asd.toString());                    }                }                else if (atsi.getActionType() == ActionTechSpecInterface.COMPENSATORY_ACTIONTYPE) {                    // Which StateDimension does this Action apply to?                    AssetStateDimension actionStateDimension = atsi.getStateDimension();                    AssetStateDimension baseStateDimension = mediatedTechSpecMap.getBaseDimension(actionStateDimension.getStateName(), diagnosisTechSpecService);                    AssetStateDimension compensatedStateDimension = mediatedTechSpecMap.getCompensatedDimension(actionStateDimension.getStateName(), diagnosisTechSpecService);                    if (logger.isDebugEnabled()) logger.debug("This COMPENSATORY Action: "+thisAction+":"+atsi+":"+actionStateDimension+":"+baseStateDimension+":"+compensatedStateDimension);                    try {                        // Get the StateDimensionEstimation for the base dimension the Action applies to - Throws an exception if SDE not found                        StateDimensionEstimation currentEstimatedBaseStateDimension = se.getStateDimensionEstimation(baseStateDimension);                        // create the Action container that will hold the evaluations of all offered Variants                        ActionEvaluation thisActionEvaluation = new ActionEvaluation(thisAction);                        cbe.addActionEvaluation(thisActionEvaluation);                        // Get the TechSpec data for all the Variants                        Collection variantDescriptions = atsi.getActions();                        // iterate thru all offered Variants of this Action                        Iterator variantIter = variantDescriptions.iterator();                        while (variantIter.hasNext()) {                            // Get TechSpec for this Variant                            ActionDescription thisVariantDescription = (ActionDescription) variantIter.next();                            boolean thisVariantActiveP = thisAction.getValue().isActive() && thisAction.getValue().getAction().equals(thisVariantDescription.name());                            // Add an entry to the current Action containing the information about this Variant                            thisActionEvaluation.addVariantEvaluation(createCompensatoryVariantEvaluation                                       (thisVariantDescription, thisActionEvaluation, currentEstimatedBaseStateDimension, thisAction,                                         baseStateDimension, compensatedStateDimension, thisVariantActiveP, knob));                        }                    }                    catch (BelievabilityException e) {                        logger.error("Cannot find StateDimensionEstimate"+e.toString());                    }                }            }            catch (TechSpecNotFoundException e) {                if (logger.isErrorEnabled()) logger.error( e.toString() );            }        }        return cbe;    }