@UnstableApi
interface ShuffleOrder

Known direct subclasses
FakeShuffleOrder

Fake ShuffleOrder which returns a reverse order.

ShuffleOrder.DefaultShuffleOrder

The default ShuffleOrder implementation for random shuffle order.

ShuffleOrder.UnshuffledShuffleOrder

A ShuffleOrder implementation which does not shuffle.


Shuffled order of indices.

The shuffle order must be immutable to ensure thread safety.

The order must be consistent when traversed both forwards and backwards.

Summary

Nested types

The default ShuffleOrder implementation for random shuffle order.

A ShuffleOrder implementation which does not shuffle.

Public functions

ShuffleOrder!

Returns a copy of the shuffle order with all elements removed.

ShuffleOrder!
cloneAndInsert(insertionIndex: Int, insertionCount: Int)

Returns a copy of the shuffle order with newly inserted elements.

ShuffleOrder!
cloneAndRemove(indexFrom: Int, indexToExclusive: Int)

Returns a copy of the shuffle order with a range of elements removed.

Int

Returns the first index in the shuffle order, or INDEX_UNSET if the shuffle order is empty.

Int

Returns the last index in the shuffle order, or INDEX_UNSET if the shuffle order is empty.

Int

Returns length of shuffle order.

Int
getNextIndex(index: Int)

Returns the next index in the shuffle order.

Int

Returns the previous index in the shuffle order.

Public functions

cloneAndClear

fun cloneAndClear(): ShuffleOrder!

Returns a copy of the shuffle order with all elements removed.

cloneAndInsert

fun cloneAndInsert(insertionIndex: Int, insertionCount: Int): ShuffleOrder!

Returns a copy of the shuffle order with newly inserted elements.

Parameters
insertionIndex: Int

The index in the unshuffled order at which elements are inserted.

insertionCount: Int

The number of elements inserted at insertionIndex.

Returns
ShuffleOrder!

A copy of this ShuffleOrder with newly inserted elements.

cloneAndRemove

fun cloneAndRemove(indexFrom: Int, indexToExclusive: Int): ShuffleOrder!

Returns a copy of the shuffle order with a range of elements removed.

Parameters
indexFrom: Int

The starting index in the unshuffled order of the range to remove.

indexToExclusive: Int

The smallest index (must be greater or equal to indexFrom) that will not be removed.

Returns
ShuffleOrder!

A copy of this ShuffleOrder without the elements in the removed range.

getFirstIndex

fun getFirstIndex(): Int

Returns the first index in the shuffle order, or INDEX_UNSET if the shuffle order is empty.

getLastIndex

fun getLastIndex(): Int

Returns the last index in the shuffle order, or INDEX_UNSET if the shuffle order is empty.

getLength

fun getLength(): Int

Returns length of shuffle order.

getNextIndex

fun getNextIndex(index: Int): Int

Returns the next index in the shuffle order.

Parameters
index: Int

An index.

Returns
Int

The index after index, or INDEX_UNSET if index is the last element.

getPreviousIndex

fun getPreviousIndex(index: Int): Int

Returns the previous index in the shuffle order.

Parameters
index: Int

An index.

Returns
Int

The index before index, or INDEX_UNSET if index is the first element.