if(ranges != null)
{
if(ranges.size() == 1)
{
Range r = ranges.getFirst();
for(int i = r.getLower(); i <= r.getUpper(); i++)
{
MessageDispositionChangeListener changeListener = _messageDispositionListenerMap.remove(i);
if(changeListener != null)
{
action.performAction(changeListener);
}
}
}
else if(!_messageDispositionListenerMap.isEmpty())
{
Iterator<Integer> unacceptedMessages = _messageDispositionListenerMap.keySet().iterator();
Iterator<Range> rangeIter = ranges.iterator();
if(rangeIter.hasNext())
{
Range range = rangeIter.next();
while(range != null && unacceptedMessages.hasNext())
{
int next = unacceptedMessages.next();
while(gt(next, range.getUpper()))
{
if(rangeIter.hasNext())
{
range = rangeIter.next();
}
else
{
range = null;
break;
}
}
if(range != null && range.includes(next))
{
MessageDispositionChangeListener changeListener = _messageDispositionListenerMap.remove(next);
action.performAction(changeListener);
}