ShuffleOrder.UnshuffledShuffleOrder


public final class ShuffleOrder.UnshuffledShuffleOrder implements ShuffleOrder


A ShuffleOrder implementation which does not shuffle.

Summary

Public fields

final int

Public constructors

Creates an instance with a specified 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

UnshuffledShuffleOrder

public UnshuffledShuffleOrder(int length)

Creates an instance with a specified length.

Parameters
int length

The length of the shuffle order.

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.