FakeShuffleOrder


@UnstableApi
public final class FakeShuffleOrder implements ShuffleOrder


Fake ShuffleOrder which returns a reverse order. This order is thus deterministic but different from the original order.

Summary

Public fields

final int

Public constructors

FakeShuffleOrder(int length)

Public methods

ShuffleOrder

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

ShuffleOrder
cloneAndInsert(int insertionIndex, int insertionCount)

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

ShuffleOrder
cloneAndRemove(int indexFrom, int indexToExclusive)

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(int index)

Returns the next index in the shuffle order.

int
getPreviousIndex(int index)

Returns the previous index in the shuffle order.

Public fields

length

public final int length

Public constructors

FakeShuffleOrder

public FakeShuffleOrder(int length)

Public methods

cloneAndClear

public ShuffleOrder cloneAndClear()

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

cloneAndInsert

public ShuffleOrder cloneAndInsert(int insertionIndex, int insertionCount)

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

Parameters
int insertionIndex

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

int insertionCount

The number of elements inserted at insertionIndex.

Returns
ShuffleOrder

A copy of this ShuffleOrder with newly inserted elements.

cloneAndRemove

public ShuffleOrder cloneAndRemove(int indexFrom, int indexToExclusive)

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

Parameters
int indexFrom

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

int indexToExclusive

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

public int getFirstIndex()

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

getLastIndex

public int getLastIndex()

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

getLength

public int getLength()

Returns length of shuffle order.

getNextIndex

public int getNextIndex(int index)

Returns the next index in the shuffle order.

Parameters
int index

An index.

Returns
int

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

getPreviousIndex

public int getPreviousIndex(int index)

Returns the previous index in the shuffle order.

Parameters
int index

An index.

Returns
int

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