logDetail( "Action trigger " + trigger.getClass().getName() + ". Updating and publishing for asset " + _asset_id );
if ( _logger.isDetailEnabled() ) _logger.detail( "Action trigger " + trigger.getClass().getName() + ". Updating and publishing for asset " + _asset_id );
    synchronized void handleBeliefTrigger( BeliefUpdateTrigger trigger )            throws BelievabilityException    {        // Method implementation comments go here ...        logDetail( "Handling trigger: " + trigger.toString() );        // There are two events that can happen which impact the        // details about how to deal with triggers: rehydration and        // unleashing.  In both cases, these effect what we use for        // the initial belief state (the first belief update after        // these events.)  The model manager has the status of whether        // or not rehydration or unleashing is happening, so we use        // this opportunity to check those and arrange our internal        // variables so that the right thing will happen when we do a        // belief update.         handleSpecialEvents();        // First step is to add the trigger (no matter what type of        // trigger this is, we add it).        //        if ( ! add( trigger ))        {            logDebug( "Trigger discarded for "                      + _asset_id + " (happened in the past?)" );            return;        }        // Now we run through the possible conditions under which we        // may want to compute a new belief state, predominantly based        // upon the type of trigger we are seeing..        // We only publish in response to a timer/alarm going off.        // However, there are four types of possible alarms that        // could trigger publishing: PublishDelayTimeTrigger,        // PublishIntervalTimeTrigger, ForceUpdateTimeTrigger and        // SensorLatencyTimeTrigger.        //        if ( trigger instanceof TimeUpdateTrigger )        {            logDetail( "Time-based update trigger "                       + trigger.getClass().getName()                       + ". Updating and publishing for asset "                       + _asset_id );            // When we are forcing an update, we want to ensure that            // any alarams started to delay the belief computation are            // cancelled.            //            if ( trigger instanceof ForceUpdateTimeTrigger )            {                cancelAlarm( _delay_alarm );                _delay_alarm = null;                cancelAlarm( _latency_alarm );                _latency_alarm = null;                // Note that we do not want to cancel the publish                // interval alarm, since we are not sure if this                // updated belief will actually be published.  If it                // will be published, then the code that will publish                // it will handle cancleling any outstanding alarm for                // that.            }            updateBeliefState( );            publishLatestBelief( );            return;        } // if an alarm trigger type occurs        // On actions, we always update the belief and publish it.        //        if ( trigger instanceof BelievabilityAction )        {                        // Note that if there is an existing delay alarm, this            // routine will do nothing.            //            if ( USE_DELAY_TIMER )            {                logDetail( "Action trigger. Starting publish delay timer for: "                           + _asset_id );                startPublishDelayTimer();            }            else            {                logDetail( "Action trigger "                           + trigger.getClass().getName()                           + ". Updating and publishing for asset "                           + _asset_id );                updateBeliefState( );                publishLatestBelief( );            }            return;        } // if action trigger                // If we have seen a diagnosis from all sensors, then we        // should not wait until the end of the max sensor latency        // period. Note that if there is only one sensor, this wil        // return true on the first diagnosis addition and thus cause        // an immediate belief computation.          //        if ( seenAllSensors() )        {            if ( USE_DELAY_TIMER )            {                logDetail( "Seen all sensors. "                           + "Starting publish delay timer for: "                           + _asset_id );                startPublishDelayTimer();            }            else            {                logDetail( "Seen all sensors. "                           + "Updating and publishing for asset "                           + _asset_id );                updateBeliefState( );                publishLatestBelief( );            }            return;                 } // if seen all sensors        // If this is the first sensor we are seeing (and there are        // more than one for this asset), then we need to start a        // timer to wait for the maximum latency time before actually        // generating a new belie state. Note that if there is only        // one known sensor, that the seenAllSensors() case above will        // be satisfied and we should not get to this condition.        //        if ( trigger instanceof BelievabilityDiagnosis )        {            if ( _current_triggers.size() == 1 )            {                logDetail( "First, diagnosis, deferring belief update for: "                           + _asset_id );                                startSensorLatencyTimer();                return;            }            else            {                logDetail( "Deferring belief update (diagnosis) for: "                           + _asset_id );                return;            }        } // if BelievabilityDiagnosis        else        {            logDebug( "unknown trigger for: "                      + _asset_id );       }           } // method handleBeliefTrigger