edu.udayton.udri.asset.novatel/src/edu/udayton/udri/asset/novatel/NovatelStatusService.java
private boolean shouldUpdateEntireStatus(final Observation statusObs)
    {
        //no former status exists, so status should be updated
        if (statusObs == null)
        {
            return true;
        }
        
        //grab list of the last component statuses
        final List<ComponentStatus> lastComponentStatuses = 
                statusObs.getStatus().getComponentStatuses();
        
        if (lastComponentStatuses.size() < m_ComponentStatusMap.size()) // must be a new status
        {
            return true;
        }
        
        //go through the last known statuses
        for (ComponentStatus formerComponentStatus : lastComponentStatuses)
        {
            //the new status if available
            final ComponentStatus newStatus = m_ComponentStatusMap.get(formerComponentStatus.getComponent());
            //if the components match descriptions then check if the old status and the new are different
            //if they are different we need a new status to be created.
            if (newStatus.getStatus().getDescription().equals(formerComponentStatus.getStatus().getDescription()))
            {
                if (newStatus.getStatus().getSummary() != formerComponentStatus.getStatus().getSummary())
                {
                    return true;
                }
            }
            else
            {
                return true;
            }
        }
        
        //went through the list, no need for a new status.
        return false;
    }
/**
     * Evaluate if the given status is actually worth updating the entire asset's status.
     * @param statusObs
     *      the observation that holds the last known status
     * @return
     *      <code> true </code> if the entire status should be updated, <code> false </code> otherwise
     */
Evaluate if the given status is actually worth updating the entire asset's status.
@param statusObs
the observation that holds the last known status
@return
true  if the entire status should be updated,  false  otherwise
Evaluate if the given status is actually worth updating the entire asset ' s status . @param statusObs the observation that holds the last known status @return true if the entire status should be updated false otherwise
private boolean shouldUpdateEntireStatus(final Observation statusObs)
    {
        if (statusObs == null)
        {
            return true;
        }
        final List<ComponentStatus> lastComponentStatuses = 
                statusObs.getStatus().getComponentStatuses();
        if (lastComponentStatuses.size() < m_ComponentStatusMap.size()) 
        {
            return true;
        }
        for (ComponentStatus formerComponentStatus : lastComponentStatuses)
        {
            final ComponentStatus newStatus = m_ComponentStatusMap.get(formerComponentStatus.getComponent());
            if (newStatus.getStatus().getDescription().equals(formerComponentStatus.getStatus().getDescription()))
            {
                if (newStatus.getStatus().getSummary() != formerComponentStatus.getStatus().getSummary())
                {
                    return true;
                }
            }
            else
            {
                return true;
            }
        }
        return false;
    }
private boolean shouldUpdateEntireStatus ( final Observation statusObs ) { if ( statusObs == null ) { return true ; } final List < ComponentStatus > lastComponentStatuses = statusObs . getStatus ( ) . getComponentStatuses ( ) ; if ( lastComponentStatuses . size ( ) < m_ComponentStatusMap . size ( ) ) { return true ; } for ( ComponentStatus formerComponentStatus : lastComponentStatuses ) { final ComponentStatus newStatus = m_ComponentStatusMap . get ( formerComponentStatus . getComponent ( ) ) ; if ( newStatus . getStatus ( ) . getDescription ( ) . equals ( formerComponentStatus . getStatus ( ) . getDescription ( ) ) ) { if ( newStatus . getStatus ( ) . getSummary ( ) != formerComponentStatus . getStatus ( ) . getSummary ( ) ) { return true ; } } else { return true ; } } return false ; }
Evaluate if the given status is actually worth updating the entire asset's status.
Evaluate if the given status is actually worth updating the entire asset ' s status .
//no former status exists, so status should be updated //grab list of the last component statuses // must be a new status //go through the last known statuses //the new status if available //if the components match descriptions then check if the old status and the new are different //if they are different we need a new status to be created. //went through the list, no need for a new status.