if (!tasksForType.remove (task)) { if (isWarnEnabled()) { warn ("no task " + task.getUID() + " in typeToTasks."); }
if (tasksForType != null) { if (!tasksForType.remove (task)) { if (isWarnEnabled()) { warn ("no task " + task.getUID() + " in typeToTasks."); } }
	public void reactToChangedFilter () {	  Enumeration addedtasks = getSubscription().getAddedList();	  while (addedtasks.hasMoreElements()) {	    Task task = (Task) addedtasks.nextElement();	    if (!(task instanceof Task))	      error ("huh? " + task + " is not an MPTask??");	    if (isInfoEnabled ()) {	      info ("uidToTask - mapping task " + task.getUID());	    }	    uidToTask.put (task.getUID (), task);	    // keep a ammo type to tasks map so we can later compare	    // an actual task with a reserved or vice versa by just examining 	    // tasks with the same ammo type	    // see #getMatchingTasksByType	    if (task.getVerb ().equals (Constants.Verb.TRANSPORT)) {	      Collection types = getTypesInContainer (task);	      for (Iterator iter = types.iterator(); iter.hasNext(); ) {		String type = (String) iter.next();		List tasksForType = (List) typeToTasks.get(type);		if (tasksForType == null) {		  typeToTasks.put (type, tasksForType = new ArrayList());		  if (isInfoEnabled()) {		    info ("adding type " + type + " to map.");		  }		}		tasksForType.add (task);	      }	    }	  }	  if (getSubscription().getRemovedList().hasMoreElements ()) {	    Set uniqueTasks = new HashSet ();	    Enumeration removedtasks = getSubscription().getRemovedList();	    while (removedtasks.hasMoreElements()) {	      Task task = (Task) removedtasks.nextElement();	      if (uniqueTasks.contains (task)) { // skip duplicate entries in removed list, if any		if (isWarnEnabled ()) { warn ("duplicate entries in removed list, skipping " + task.getUID()); }		continue;	      }	      else {		uniqueTasks.add (task);	      }	      if (uidToTask.remove (task.getUID()) == null) {		if (isWarnEnabled ()) { warn ("no task in uidToTask map with uid " + task.getUID ());	}	      }	      else {		if (isInfoEnabled ()) { info ("uidToTask - removing task uid " + task.getUID() + " from map."); }	      }	      // keep a ammo type to tasks map so we can later compare	      // an actual task with a reserved or vice versa by just examining 	      // tasks with the same ammo type	      // see #getMatchingTasksByType	      if (task.getVerb ().equals (Constants.Verb.TRANSPORT)) {		Collection types = getTypesInContainer (task);		for (Iterator iter = types.iterator(); iter.hasNext(); ) {		  String type = (String) iter.next();		  List tasksForType = (List) typeToTasks.get(type);		  if (!tasksForType.remove (task)) {		    if (isWarnEnabled()) { warn ("no task " + task.getUID() + " in typeToTasks."); }		  }		}	      }	    }	  }	}