@Test public void initialState_nextInsertionPosition() { assertThat(noAds.nextInsertionPosition(0)).isEqualTo(NOT_FOUND); assertThat(noAds.nextInsertionPosition(1)).isEqualTo(NOT_FOUND); assertThat(adAt0.nextInsertionPosition(0)).isEqualTo(NOT_FOUND); assertThat(adAt0.nextInsertionPosition(1)).isEqualTo(NOT_FOUND); assertThat(adAt1.nextInsertionPosition(0)).isEqualTo(1); assertThat(adAt1.nextInsertionPosition(1)).isEqualTo(NOT_FOUND); assertThat(adAt1.nextInsertionPosition(2)).isEqualTo(NOT_FOUND); assertThat(adsAt01.nextInsertionPosition(0)).isEqualTo(NOT_FOUND); assertThat(adsAt01.nextInsertionPosition(1)).isEqualTo(NOT_FOUND); assertThat(adsAt01.nextInsertionPosition(2)).isEqualTo(NOT_FOUND); assertThat(adsAt14.nextInsertionPosition(0)).isEqualTo(1); assertThat(adsAt14.nextInsertionPosition(1)).isEqualTo(3); assertThat(adsAt14.nextInsertionPosition(2)).isEqualTo(3); assertThat(adsAt14.nextInsertionPosition(3)).isEqualTo(NOT_FOUND); assertThat(adsAt14.nextInsertionPosition(4)).isEqualTo(NOT_FOUND); assertThat(adsRepeating.nextInsertionPosition(0)).isEqualTo(2); assertThat(adsRepeating.nextInsertionPosition(1)).isEqualTo(2); assertThat(adsRepeating.nextInsertionPosition(2)).isEqualTo(4); assertThat(adsRepeating.nextInsertionPosition(3)).isEqualTo(4); assertThat(adsRepeating.nextInsertionPosition(4)).isEqualTo(6); assertThat(adsRepeating.nextInsertionPosition(5)).isEqualTo(6); assertThat(adsRepeating.nextInsertionPosition(6)).isEqualTo(8); assertThat(adsAt15repeating.nextInsertionPosition(0)).isEqualTo(1); assertThat(adsAt15repeating.nextInsertionPosition(1)).isEqualTo(4); assertThat(adsAt15repeating.nextInsertionPosition(2)).isEqualTo(4); assertThat(adsAt15repeating.nextInsertionPosition(3)).isEqualTo(4); assertThat(adsAt15repeating.nextInsertionPosition(4)).isEqualTo(6); assertThat(adsAt15repeating.nextInsertionPosition(5)).isEqualTo(6); assertThat(adsAt15repeating.nextInsertionPosition(6)).isEqualTo(8); assertThat(adsAt15repeating.nextInsertionPosition(7)).isEqualTo(8); assertThat(adsAt15repeating.nextInsertionPosition(8)).isEqualTo(10); assertThat(adsAt1234.nextInsertionPosition(0)).isEqualTo(1); assertThat(adsAt1234.nextInsertionPosition(1)).isEqualTo(NOT_FOUND); assertThat(adsAt1234.nextInsertionPosition(2)).isEqualTo(NOT_FOUND); assertThat(adsAt1234.nextInsertionPosition(3)).isEqualTo(NOT_FOUND); assertThat(adsAt1234.nextInsertionPosition(4)).isEqualTo(NOT_FOUND); assertThat(adsAt1234.nextInsertionPosition(5)).isEqualTo(NOT_FOUND); }
int nextInsertionPosition(final int position) { final int index = binarySearchGreaterThan( mDesiredInsertionPositions, mDesiredCount, position); if (index == mDesiredCount) { return NOT_FOUND; } return mDesiredInsertionPositions[index]; }
PlacementData { int nextInsertionPosition(final int position) { final int index = binarySearchGreaterThan( mDesiredInsertionPositions, mDesiredCount, position); if (index == mDesiredCount) { return NOT_FOUND; } return mDesiredInsertionPositions[index]; } }
PlacementData { int nextInsertionPosition(final int position) { final int index = binarySearchGreaterThan( mDesiredInsertionPositions, mDesiredCount, position); if (index == mDesiredCount) { return NOT_FOUND; } return mDesiredInsertionPositions[index]; } private  PlacementData(@NonNull final int[] desiredInsertionPositions); }
PlacementData { int nextInsertionPosition(final int position) { final int index = binarySearchGreaterThan( mDesiredInsertionPositions, mDesiredCount, position); if (index == mDesiredCount) { return NOT_FOUND; } return mDesiredInsertionPositions[index]; } private  PlacementData(@NonNull final int[] desiredInsertionPositions);  }
PlacementData { int nextInsertionPosition(final int position) { final int index = binarySearchGreaterThan( mDesiredInsertionPositions, mDesiredCount, position); if (index == mDesiredCount) { return NOT_FOUND; } return mDesiredInsertionPositions[index]; } private  PlacementData(@NonNull final int[] desiredInsertionPositions);  final static int NOT_FOUND; }