INNER CODE UNIT · Java
wrapDistance
robinhood/ticker · ticker/src/main/java/com/robinhood/ticker/TickerCharacterList.java:99
final int wrapDistance = numOriginalCharacters - startIndex + endIndex;
if (wrapDistance < nonWrapDistance) {
endIndex += numOriginalCharacters;
}
} else if (startIndex < endIndex) {
// If we are potentially going forwards
final int nonWrapDistance = endIndex - startIndex;
final int wrapDistance = numOriginalCharacters - endIndex + startIndex;
if (wrapDistance < nonWrapDistance) {
startIndex += numOriginalCharacters;
}
}
}
break;
}
return new CharacterIndices(startIndex, endIndex);