// //remove the analyzer from the priority map in any case
// lockSeekingAnalyzersToPriority.remove(ia);
// }
Set<AbstractCursorProcessor> keys = lockSeekingProcessorsToPriority.keySet();
for (Iterator<AbstractCursorProcessor> iterator = keys.iterator(); iterator.hasNext();) {
AbstractCursorProcessor inputProcessor = iterator.next();
if (inputProcessor.equals(ia)){
iterator.remove();
logger.debug("Removed " + ia + " from lockSeekingAnalyzersToPriority list.");
}
}
//dont send released signal if cursor was consumed by higher priority anyway
//should actually not occur because we should only call release when we have a lock on the cursor
if (beforeLockPriority > unlockingGesturePriority){
logger.debug("Trying to unlock cursor, but cursor was already locked by higher priority.");
return;
}
int afterRemoveLockPriority = this.getCurrentLockPriority();
//Only send released signal if the priority really was lowered by releasing (there can be more than 1 lock with the same lock priority)
if (beforeLockPriority > afterRemoveLockPriority){
if (!interestedProcessorsToPriority.isEmpty()){
//Get strictly smaller priority gestures than the one relreasing, so that the ones with same priority dont get a signal
SortedMap<AbstractCursorProcessor, Integer> lesserPriorityGestureMap = interestedProcessorsToPriority.headMap(interestedProcessorsToPriority.lastKey());
// SortedMap<IInputAnalyzer, Integer> lesserPriorityGestureMap = watchingAnalyzersToPriority.headMap(ia);
Set<AbstractCursorProcessor> lesserPriorityGestureKeys = lesserPriorityGestureMap.keySet();
for (Iterator<AbstractCursorProcessor> iterator = lesserPriorityGestureKeys.iterator(); iterator.hasNext();) {
AbstractCursorProcessor processor = (AbstractCursorProcessor) iterator.next();
//Only send released signal to the analyzers whos priority is higher than the current cursor priority
//the current highest priority of the cursor can change when released is called on a gesture that successfully
//locks this cursor, so check each loop iteration
if ( processor.getLockPriority() < unlockingGesturePriority //Only call on gestures with a lower priority than the one releasing the lock
&& this.getCurrentLockPriority() <= processor.getLockPriority() //only call unLocked on analyzers with a lower or equal lockpriority
){
processor.cursorUnlocked(this);
//FIXME funktioniert das, wenn bei claim in anderer geste wieder was in die liste geadded wird etc?
}
}
}
}