Class ShuffleOrder.DefaultShuffleOrder

    • Constructor Detail

      • DefaultShuffleOrder

        public DefaultShuffleOrder​(int length)
        Creates an instance with a specified length.
        Parameters:
        length - The length of the shuffle order.
      • DefaultShuffleOrder

        public DefaultShuffleOrder​(int length,
                                   long randomSeed)
        Creates an instance with a specified length and the specified random seed. Shuffle orders of the same length initialized with the same random seed are guaranteed to be equal.
        Parameters:
        length - The length of the shuffle order.
        randomSeed - A random seed.
      • DefaultShuffleOrder

        public DefaultShuffleOrder​(int[] shuffledIndices,
                                   long randomSeed)
        Creates an instance with a specified shuffle order and the specified random seed. The random seed is used for cloneAndInsert(int, int) invocations.
        Parameters:
        shuffledIndices - The shuffled indices to use as order.
        randomSeed - A random seed.
    • Method Detail

      • getLength

        public int getLength()
        Description copied from interface: ShuffleOrder
        Returns length of shuffle order.
        Specified by:
        getLength in interface ShuffleOrder
      • getNextIndex

        public int getNextIndex​(int index)
        Description copied from interface: ShuffleOrder
        Returns the next index in the shuffle order.
        Specified by:
        getNextIndex in interface ShuffleOrder
        Parameters:
        index - An index.
        Returns:
        The index after index, or C.INDEX_UNSET if index is the last element.
      • getPreviousIndex

        public int getPreviousIndex​(int index)
        Description copied from interface: ShuffleOrder
        Returns the previous index in the shuffle order.
        Specified by:
        getPreviousIndex in interface ShuffleOrder
        Parameters:
        index - An index.
        Returns:
        The index before index, or C.INDEX_UNSET if index is the first element.
      • cloneAndInsert

        public ShuffleOrder cloneAndInsert​(int insertionIndex,
                                           int insertionCount)
        Description copied from interface: ShuffleOrder
        Returns a copy of the shuffle order with newly inserted elements.
        Specified by:
        cloneAndInsert in interface ShuffleOrder
        Parameters:
        insertionIndex - The index in the unshuffled order at which elements are inserted.
        insertionCount - The number of elements inserted at insertionIndex.
        Returns:
        A copy of this ShuffleOrder with newly inserted elements.
      • cloneAndRemove

        public ShuffleOrder cloneAndRemove​(int indexFrom,
                                           int indexToExclusive)
        Description copied from interface: ShuffleOrder
        Returns a copy of the shuffle order with a range of elements removed.
        Specified by:
        cloneAndRemove in interface ShuffleOrder
        Parameters:
        indexFrom - The starting index in the unshuffled order of the range to remove.
        indexToExclusive - The smallest index (must be greater or equal to indexFrom) that will not be removed.
        Returns:
        A copy of this ShuffleOrder without the elements in the removed range.