AssetStateDescriptor asd = (AssetStateDescriptor) asd_enum.nextElement();
AssetStateDimension asd = (AssetStateDimension) asd_enum.nextElement();
            processDiagnosis( TimedDefenseDiagnosis timed_diagnosis )             throws BelievabilityException     {        if ( (LOCAL_DEBUG_LEVEL >= 5) && _logger.isDebugEnabled())             _logger.debug("Processing diagnosis...");        // Get the current asset information, including the current         // belief state of the asset. GetAssetModel may throw a         // BelievabilityException        String asset_ext_name = timed_diagnosis.getAssetName();        AssetModel asset_model = getAssetModel( asset_ext_name );        BeliefUpdate belief = asset_model.getBeliefUpdate();        // This is the object to be returned.        //        StateEstimation se = new StateEstimation( asset_ext_name );        // The timed_diagnosis is a set of 	// DefenseApplicabilityConditionSnapshots for a        // given asset.  Each DefenseApplicabilityConditionSnapshot	// we assume (for now) to        // be applicable to *all* asset state descriptors of this        // asset.  Thus, we loop over all of the        // DefenseApplicabilityConditionSnapshots to create a	// composite diagnosis, which is        // used as the observation for all asset state descriptors.         // We then loop over all the state descriptors and        // independently compute the belief state over each one.        //  We do not assume that all defenses will be reporting        // something in the TimedDefenseDiagnosis.  We consult the        // techspecs for all defenses for a given asset, and any that        // are not present, we assume to be reporting "OK".         //        CompositeDiagnosis composite_diagnosis = new CompositeDiagnosis();        if ( _logger.isDebugEnabled() )             _logger.debug("  Building composite diagnosis for: "                          + asset_ext_name );        Iterator td_iter = timed_diagnosis.iterator();        while ( td_iter.hasNext() )        {            DefenseApplicabilityConditionSnapshot dc =		(DefenseApplicabilityConditionSnapshot) td_iter.next();            	    String defense_name = getDefenseModelKey( dc.getDefenseName(),						       dc.getAssetType() );            if (  _logger.isDebugEnabled() )                 _logger.debug("    Handling defense condition for "			      + defense_name );            DefenseTechSpecInterface defense_tsi;            // It is possible that not all the defenses are currently            // known.  If we do not know it, then we will just go with            // those we do know about.            try            {                defense_tsi = getDefenseTS( dc.getDefenseName(), 					    dc.getAssetType() );            }            catch (BelievabilityException be)            {                if ((LOCAL_DEBUG_LEVEL >= 5) && _logger.isDebugEnabled())                     _logger.debug("    " + be.getMessage() + " (skipping)" );                continue;            }            // We also assume there is only one monitoring level for a            // defense (again, another assumption that wil not hold in            // the long term.)            //            MonitoringLevel ml =                     (MonitoringLevel)                     defense_tsi.getMonitoringLevels().firstElement();            // We need to find the asset sate descriptor that this            // defense is monitoring.             //            Vector diagnosis_accuracy_functions = ml.getDiagnosisAccuracy();            // Assume there is only one diagnosis accuracy function            // for a defense. (i.e., a defense only monitors a singl;e            // asset state descriptor.            //            DiagnosisAccuracyFunction daf                     = (DiagnosisAccuracyFunction)                     diagnosis_accuracy_functions.elementAt( 0 );            // The diagnosis name is needed to do a belief update            // since this translates into the POMDP observation needed            // in the belief update formula.            //            String diagnosis_name;            if ( dc.getValue().toString().equalsIgnoreCase                 ( DefenseConstants.BOOL_TRUE.toString() ))            {                // This should get us the "non-ok" diagnosis name                diagnosis_name                         = getDiagnosisName( dc,                                             diagnosis_accuracy_functions );            }  // if defense thinks it is applicable            else            {                // Passing in a 'null' should get us the "ok"                // diagnosis name.                diagnosis_name                         = getDiagnosisName( null,                                             diagnosis_accuracy_functions );            }  // defense does not think it is applicable            if (_logger.isDebugEnabled())                 _logger.debug("      Adding diagnosis component: "                              + dc.getDefenseName() + "="                               + diagnosis_name );            // The actual diagnosis used to compute the belief state            // is a composite set of all the defenses that monitor            // this asset. Here we are entering the individual            // components of that diagnosis in a form that will be            // easier for the belief state update routines to handle            // (it will save those routines from having to iterate            // through all the techspecs.            //            composite_diagnosis.add( dc,                                       ml.getName(),                                      diagnosis_name );            // It is useful to be able to access the individual            // defenbse conditions downstream.  Since they are the            // same for all AssetBeliefState, we store them also in            // the StateEstimation object.            //            se.addDefenseCondition( dc );        } // end while loop over defense conditions in timed def diag        // Even if we have a problem with finding defense techspecs,        // we would like to notify the downstream elements that there        // were some TimedDefenseDiagnosis objects published.  Maybe        // those component will know what to do about this exceptional        // condition.        //        if ( composite_diagnosis.size() < 1 )        {            if (_logger.isDebugEnabled())                 _logger.debug("Could not find any defense"                              + " techspecs for defense conditions." );                        se.logError( "Believability update could not find any defense"                         + " techspecs for defense conditions.\n" );                        return se;        }	if (_logger.isDebugEnabled()) 	    _logger.debug("Composite diagnosis is " 			  + composite_diagnosis.toString() );        // FIXME: Because the threat likelihood probabilities can vary        // over time, if the threat probability changes in the middle        // of a belief state computation we will have problems with        // the belief update computations.  We need to prevent this        // from happening.        //        // One possible solution is to put a call right here that is        // something like:        //        //   this.snapshotThreatLikelihood( asset_ext_name );        //        // Whch will look up the current threat likelihood once and        // cache the value.  Then, all references to looking up the        // threat likelihood should *not* refer to the techspecs, but        // to this cached value.        //	// NOTE: The defense conditions are now snapshots, and will not	// change. This should stabilize this some. -- Misty        // Once we have the composite diagnosis, we now have to        // iterate over all the asset state descriptors, computing a        // new belief state for each desciptor (independently).        //        if ((LOCAL_DEBUG_LEVEL >= 5) && _logger.isDebugEnabled())             _logger.debug("  Computing a.s.d belief states: "                          + asset_ext_name );        Vector asd_list = asset_model.getAssetStateDescriptors();        Enumeration asd_enum = asd_list.elements();        while ( asd_enum.hasMoreElements() )        {             AssetStateDescriptor asd                     = (AssetStateDescriptor) asd_enum.nextElement();            if (_logger.isDebugEnabled())                 _logger.debug("Handling asset state: " + asd.getStateName() );            // If something goes wrong i the belief calculation, we            // want to still return a state estimation for as much            // stuff as we can.  However, we also want to signal that            // a problem occurred.            //            try            {                // This is where the calculations really happen.                //                AssetBeliefState asset_bs                         = belief.update( asd, composite_diagnosis );                            se.put( asd, asset_bs );            }            catch (BelievabilityException be)            {                if (this._logger.isDebugEnabled())                     this._logger.debug                            ( "Logging belief update error to S.E. (a.s.d. "                              + asd.getStateName()                               + ")\n    Exception msg: "                              + be.getMessage() );                se.logError( "Problem with belief update for a.s.d. "                             + asd.getStateName() + "\n"                             + be.getMessage() + "\n" );            }                    }  // while asd_enum        if ( se.size() < 1 )        {            if (this._logger.isDebugEnabled())                 this._logger.debug                        ( "Returning empty StateEstimation" );                        se.logError( "None of the belief updates succeeded.\n" );        }        return se;            }