INNER CODE UNIT · Java
nonWrapDistance
robinhood/ticker · ticker/src/main/java/com/robinhood/ticker/TickerCharacterList.java:98
final int nonWrapDistance = startIndex - endIndex;
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;
}