{
if (!_hasUnnavigableErrors) {
return _orderedUndisplayedErrors;
}
SparseVector /*AWErrorBucket*/ sortedErrors =
new SparseVector(_orderedUndisplayedErrors.size(), false);
allocEmptySlots(sortedErrors, _orderedUndisplayedErrors.size());
int bottomCounter = _orderedUndisplayedErrors.size() - 1;
Map<Integer, AWErrorBucket> unnavigableErrors = MapUtil.map();
int highestUnnavNumber = 0;
for (int i = _orderedUndisplayedErrors.size() - 1; i >= 0; i--) {
AWErrorBucket bucket = _orderedUndisplayedErrors.get(i);
if (bucket.getUnnavigableDisplayOrder() != AWErrorInfo.NotDisplayed) {
// pick out the unnavigable errors
Integer key = Constants.getInteger(bucket.getUnnavigableDisplayOrder());
unnavigableErrors.put(key, bucket);
highestUnnavNumber = Math.max(bucket.getUnnavigableDisplayOrder(), highestUnnavNumber);
}
else {
sortedErrors.add(bottomCounter, bucket);
bottomCounter--;
}
}
int topCounter = 0;
int start = (positioningError.getUnnavigableDisplayOrder() != AWErrorInfo.NotDisplayed)
? positioningError.getUnnavigableDisplayOrder() + 1
: 0;
for (int i = start; i <= highestUnnavNumber; i++) {
Integer key = Constants.getInteger(i);
AWErrorBucket bucket = unnavigableErrors.get(key);
if (bucket != null) {
sortedErrors.add(topCounter, bucket);
topCounter++;
}
}
for (int i = 0; i < start; i++) {
Integer key = Constants.getInteger(i);
AWErrorBucket bucket = unnavigableErrors.get(key);
if (bucket != null) {
sortedErrors.add(topCounter, bucket);
topCounter++;
}
}
return sortedErrors;