AssetStateDescriptor asd = getAssetStateDescriptor ( asset_expanded_name,
AssetStateDimension asd = getAssetStateDimension ( asset_expanded_name,
    public double getTransProbability( String asset_expanded_name,                                       String state_descriptor_name,                                       String from_descriptor_value,                                       String to_descriptor_value,                                       long start_time,                                       long end_time )            throws BelievabilityException     {        // Get the AssetModel. May throw BeleivabilityException        AssetModel am = getAssetModel( asset_expanded_name );        if ( (LOCAL_DEBUG_LEVEL >= 5) && _logger.isDebugEnabled() )             _logger.debug( "getTransProb : "                           + from_descriptor_value                           + " -> "                            + to_descriptor_value                           + "\n   time = [ "                           + start_time + ", "                           + end_time + " ]" );        if (_logger.isDebugEnabled() && (start_time >= end_time) )             _logger.debug( "getTransProb -- negative time from state " );         // Get the AssetStateDescriptor. This may throw a        // BelievabilityException        AssetStateDescriptor asd =                 getAssetStateDescriptor ( asset_expanded_name,                                           state_descriptor_name );                // Iterate through the threat models, looking for one that         // has a damage distribution vector that pertains to the state        // descriptor. Choose the first one you find.        //        boolean threat_found = false;        Enumeration tm_enum = _threat_models.elements();        while ( tm_enum.hasMoreElements() )         {            // Get the threat model            ThreatModelInterface tmi =                     (ThreatModelInterface) tm_enum.nextElement();                  // See if the threat model covers this asset. If not, skip            // to next            if ( ! tmi.containsAsset( am.getAssetTS() ) ) {		if (_logger.isDebugEnabled() ) 		    _logger.debug( " getTransProb : threat "				   + tmi.getName()				   + " does not contain asset " 				   + am.getAssetTS().getExpandedName() );                continue;	    }            threat_found = true;            // Check if the threat model has a damage distribution            // vector that covers the named state descriptor            //            Vector ddv = tmi.getDamageDistributionVector();            Enumeration dd_enum = ddv.elements();            while ( dd_enum.hasMoreElements() )             {                DamageDistribution dd =                        (DamageDistribution) dd_enum.nextElement();		if ( ! dd.getAssetState().equals( asd ) ) {		    continue;		}				if ( dd.getStartState().getName().equalsIgnoreCase		     ( from_descriptor_value ) &&		     dd.getEndState().getName().equalsIgnoreCase		     ( to_descriptor_value ) ) {                    // HA! Found it!                    double threat_likelihood =                            tmi.getThreatLikelihood( start_time, end_time );                    double transition_likelihood_given_threat =                             dd.getProbability();                    // FIXME: Here is a big assumption that should be verified:                    // If the threat *does not* get realized, then the asset                    // does not change state (i.e., transition matrix is                    // identity matrix.                    //                    double transition_likelihood_without_threat;                    if ( from_descriptor_value.equalsIgnoreCase                         ( to_descriptor_value ))                        transition_likelihood_without_threat                                 = 1.0 - threat_likelihood;                    else                        transition_likelihood_without_threat = 0.0;                    if (_logger.isDebugEnabled() )                         _logger.debug( " getTransProb : Pr("                                       + from_descriptor_value                                       + " -> "                                        + to_descriptor_value                                       + ") =  Pr(T)="                                       + threat_likelihood + " * "                                       + "Pr(next|prev,T)="                                       + transition_likelihood_given_threat                                       + " + Pr(next ^ ~T)="                                       + transition_likelihood_without_threat);                     // ASSUMPTION: There is only one threat that                    // affects any given state descriptor.  This is                    // why we return the first matching value we find.                    //                    return ( ( threat_likelihood                                * transition_likelihood_given_threat)                             + transition_likelihood_without_threat );                }  // if found the appropriate damage distribution            } // end iteration over damage distribution vector            // NOTE: Even when we find an applicable threat, this may            // not actually affect the state descriptor we care about            // here.  Thus, if we find no damage distributions, we            // still need to loop over the rest of the threat model to            // see if another threat impacts it.        } // end iteration over threat models                // If we loop over all threats and damage distributions and do        // not find one that is applicable to this asset state        // desciptor, then we assume that there is nothing that will        // cause this asset desciptor's state to change.  Thus, the        // transition probabilities will be 1.0 if it is a        // self-transition, and zero otherwise (the identity        // transition function).        //        double prob = 0.0;        if ( from_descriptor_value.equalsIgnoreCase( to_descriptor_value ))            prob = 1.0;                // Nothing found, return zero probability        if (_logger.isDebugEnabled() )             _logger.debug( "getTransProb : Pr("                           + from_descriptor_value                           + " -> "                            + to_descriptor_value                           + ") Pr(T)=" + prob + " (no threat found)" );        return prob;    }