logger.debug("evaluateAssetMembership called with " + changesToProcess.size() + " events");
if (logger.isDebugEnabled()) logger.debug("evaluateAssetMembership called with " + changesToProcess.size() + " events");
    private void evaluateAssetMembership() {        synchronized(changesToProcess) {            //If no new assets or new threats, don't do anything            if (changesToProcess.size() == 0 ) { return; }            TransitiveEffectDescription transitiveEffectDesc;            AssetChangeEvent event;            TransitiveEffectModel transitiveEffectModel;            DefaultAssetTechSpec asset;                        Vector changedModels = new Vector(); //keep track so we can publish change them to the BB.            logger.debug("evaluateAssetMembership called with " + changesToProcess.size() + " events");            //Iterate over transitiveEffectDescriptions            if ( (transitiveEffectDescriptions != null && transitiveEffectDescriptions.size() > 0) ) {                Iterator i = transitiveEffectDescriptions.iterator();                while (i.hasNext()) {                    transitiveEffectDesc = (TransitiveEffectDescription)i.next();                        Iterator ctp = changesToProcess.iterator();                        while (ctp.hasNext()) {                            transitiveEffectModel = null;                            event = (AssetChangeEvent)ctp.next();                            asset = (DefaultAssetTechSpec) event.getAsset();                                                        if (event.moveEvent() || event.newAssetEvent() ) {                                //IF the agent moved or is new                                //check to see if the asset qualifies                                //** First check type of asset against type of transitiveEffectModel. Ignore if they don't match                                if (!(transitiveEffectDesc.getTransitiveAssetType().equals(asset.getAssetType()))) {                                    continue;                                }                                boolean qualifies = true; //assume the asset qualifies, until a filter rejects it.                                TransitiveEffectVulnerabilityFilter filter = transitiveEffectDesc.getTransitiveVulnerabilityFilter();                                //IF NO FILTER -- add the asset as a member                                if (filter == null) {                                    qualifies = true;                                } else { //OK, there are FILTERS, so see if the asset qualifies                                    qualifies = filter.qualifies(this, asset);                                                                    }                                if (qualifies) {                                    logger.debug("==> "+asset.getName()+"["+asset.getAssetType().getName()+"] Qualifies! Adding to the transitive effect for event: "+transitiveEffectDesc.getTransitiveEventName()+" transitiveEffectModel ["+transitiveEffectDesc.getTransitiveAssetType().getName()+"]");                                    transitiveEffectModel = addAssetAsMember(asset, transitiveEffectDesc);                                } else { //remove the asset from the threat model's membership, if it's there                                                             transitiveEffectModel = removeAssetAsMember(asset, transitiveEffectDesc);                                                                                            if (transitiveEffectModel != null) {                                        logger.debug("==> "+asset.getName()+"["+asset.getAssetType().getName()+"] was REMOVED from the transitive effect for event: "+transitiveEffectDesc.getTransitiveEventName()+" transitiveEffectModel ["+transitiveEffectDesc.getTransitiveAssetType().getName()+"]");                                    }                                }                                                              //If the asset was removed, just remove from this threat, if there                            } else if (event.assetRemovedEvent() ) {                                    transitiveEffectModel = removeAssetAsMember(asset, transitiveEffectDesc);                                                                                           if (transitiveEffectModel != null) {                                        logger.debug("==> "+asset.getName()+"["+asset.getAssetType().getName()+"] was REMOVED from "+transitiveEffectDesc.getTransitiveEventName()+" transitiveEffectModel ["+transitiveEffectDesc.getTransitiveAssetType().getName()+"]");                                    }                            }                            //Now if the transitiveEffectModel != null, then it was changed so add it to the list to publishChange                            if (transitiveEffectModel != null) {                                if (! changedModels.contains(transitiveEffectModel)) {                                    changedModels.addElement(transitiveEffectModel);                                }                            }                                                    } //while loop - on asset change events                } //while() loop on ThreatDescriptions iterator                if (changedModels.size() > 0) {                     Iterator cModels = changedModels.iterator();                    while (cModels.hasNext()) {                        TransitiveEffectModel dtm = (TransitiveEffectModel) cModels.next();                        Collection changes = Collections.singleton( new TransitiveEffectModelChangeEvent( dtm, TransitiveEffectModelChangeEvent.MEMBERSHIP_CHANGE ) );                        this.blackboard.publishChange(dtm, changes);                    }                }            } //if - there are any threat models            //Now remove all processed events            changesToProcess.removeAllElements();        } //synchronized    }