in harry-core/src/harry/model/OpSelectors.java [385:401]
public long prevLts(long lts)
{
long slideCount = lts / switchAfter;
long positionInCycle = lts - slideCount * switchAfter;
long prevRepeat = positionInCycle / windowSize - 1;
if (lts < windowSize ||
prevRepeat < -1 ||
(prevRepeat == -1 && (positionInCycle % windowSize) == (windowSize - 1)))
return -1;
// last cycle before window slides; next window will have shifted by one
if (prevRepeat == -1)
positionInCycle += 1;
return slideCount * switchAfter - windowSize + positionInCycle;
}