// 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 java.util.Arrays;
	private Node[] stack;
	private int start;

	/**
	 * If <code>true</code>, {@link #buildSuffixArray(int[], int, int)} uses a copy of the input so it is left intact.
	 */
	private final boolean preserveInput;

	public DeepShallow() {
		preserveInput = true;
	}

	public DeepShallow(boolean preserveInput) {
		this.preserveInput = preserveInput;
	}

	/**
	 * {@inheritDoc}
	 * <p>
	 * Additional constraints enforced by Deep-Shallow algorithm:
	 * <ul>
	 * <li>non-negative (&ge;0) symbols in the input</li>
	 * <li>maximal symbol value &lt; <code>256</code></li>
	 * <li><code>input.length</code> &ge; <code>start + length</code> if {@link #preserveInput} is <tt>true</tt></li>
	 * <li><code>input.length</code> &ge; <code>start + length + {@link #OVERSHOOT}</code> if {@link #preserveInput} is <tt>false</tt></li>
	 * <li>length >= 2</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/DeepShallow.java
import static org.jsuffixarrays.Tools.assertAlways;
import java.util.Arrays;

	private Node[] stack;
	private int start;

	/**
	 * If <code>true</code>, {@link #buildSuffixArray(int[], int, int)} uses a copy of the input so it is left intact.
	 */
	private final boolean preserveInput;

	public DeepShallow() {
		preserveInput = true;
	}

	public DeepShallow(boolean preserveInput) {
		this.preserveInput = preserveInput;
	}

	/**
	 * {@inheritDoc}
	 * <p>
	 * Additional constraints enforced by Deep-Shallow algorithm:
	 * <ul>
	 * <li>non-negative (&ge;0) symbols in the input</li>
	 * <li>maximal symbol value &lt; <code>256</code></li>
	 * <li><code>input.length</code> &ge; <code>start + length</code> if {@link #preserveInput} is <tt>true</tt></li>
	 * <li><code>input.length</code> &ge; <code>start + length + {@link #OVERSHOOT}</code> if {@link #preserveInput} is <tt>false</tt></li>
	 * <li>length >= 2</li>
	 * </ul>
	 */
	@Override
	public int[] buildSuffixArray(int[] input, int start, int length) {
		Tools.assertAlways(input.length >= start + length, "Input array is too short");