// Path: src/main/java/org/jsuffixarrays/Tools.java
// static final void assertAlways(boolean condition, String msg)
// {
//     if (!condition)
//     {
//         throw new AssertionError(msg);
//     }
// }


import static org.jsuffixarrays.Tools.assertAlways;
import com.carrotsearch.hppc.sorting.IndirectComparator;
import com.carrotsearch.hppc.sorting.IndirectSort;
import com.google.common.primitives.Ints;

package org.jsuffixarrays;



/**
 * A naive implementation of suffix sorting based on primitive integer collections and
 * custom sorting routines (quicksort).
 */
public final class NaiveSort implements ISuffixArrayBuilder
{
    /**
     * {@inheritDoc}
     * <p>
     * Additional constraints enforced by this implementation:
     * <ul>
     * <li>{@link Integer#MIN_VALUE} must not occur in the input</li>,
     * <li><code>input.length</code> &gt;= <code>start + length + 1</code> (to simplify
     * border cases)</li>
     * </ul>
     */
    @Override
    public int [] buildSuffixArray(int [] input, int start, int length)
    {

// Path: src/main/java/org/jsuffixarrays/Tools.java
// static final void assertAlways(boolean condition, String msg)
// {
//     if (!condition)
//     {
//         throw new AssertionError(msg);
//     }
// }


// Path: src/main/java/org/jsuffixarrays/NaiveSort.java
import static org.jsuffixarrays.Tools.assertAlways;
import com.carrotsearch.hppc.sorting.IndirectComparator;
import com.carrotsearch.hppc.sorting.IndirectSort;
import com.google.common.primitives.Ints;

package org.jsuffixarrays;



/**
 * A naive implementation of suffix sorting based on primitive integer collections and
 * custom sorting routines (quicksort).
 */
public final class NaiveSort implements ISuffixArrayBuilder
{
    /**
     * {@inheritDoc}
     * <p>
     * Additional constraints enforced by this implementation:
     * <ul>
     * <li>{@link Integer#MIN_VALUE} must not occur in the input</li>,
     * <li><code>input.length</code> &gt;= <code>start + length + 1</code> (to simplify
     * border cases)</li>
     * </ul>
     */
    @Override
    public int [] buildSuffixArray(int [] input, int start, int length)
    {

        assertAlways(input != null, "input must not be null");
