×
Samples Blogs Make Payment About Us Reviews 4.9/5 Order Now

Implement a Complete Tree Using Array in Java Assignment Solution

July 02, 2024
Alex Thompson
Alex Thompson
🇺🇸 United States
Java
Alex Thompson is a skilled Java Assignment Expert with 8 years of experience. He completed his Master's degree at Stanford University, USA.
Key Topics
  • Instructions
  • Requirements and Specifications
Tip of the day
Use well-structured shaders to optimize rendering and ensure efficient resource management. Start with simple shapes, gradually adding complexity, and debug in small steps to identify errors easily.
News
An open-source framework that allows developers to create rich Python applications in the browser using HTML's interface, bridging the gap between web development and Python scripting.

Instructions

Objective
If you require assistance with a Java assignment, I can help you with the task of implementing a complete tree using an array in the Java language. Trees are fundamental data structures that have applications in various fields of computer science. In Java, you can utilize arrays to efficiently represent a complete tree, where each element of the array corresponds to a node in the tree. This involves careful index manipulation and mathematical calculations to maintain the hierarchical relationships.

Requirements and Specifications

program to implement a complete tree using array in java
program to implement a complete tree using array in java 1
program to implement a complete tree using array in java 2

Source Code

ABSTRACT TEST SORT

import java.util.Arrays;

import java.util.Comparator;

import java.util.Random;

import edu.uwm.cs351.ImmutableSortObject;

import edu.uwm.cs351.SortHarness;

import edu.uwm.cs351.SortObject;

import edu.uwm.cs351.Sorter;

import edu.uwm.cs351.SortStat;

import junit.framework.TestCase;

public abstract class AbstractTestSort extends TestCase {

 protected abstract Sorter getAlgorithm();

 // for internal tests:

 protected Sorter algorithm = getAlgorithm();

 protected SortObject self;

 protected void setUp(Comparator comp, int... values) {

  Integer[] array = new Integer[values.length];

  for (int i=0; i < values.length; ++i) {

   array[i] = values[i];

  }

  self = new ImmutableSortObject<>(array, comp);

 }

 protected void setUp(int ... values) {

  setUp((Comparator )null, values);

 }

 // for numbered tests:

 protected void assertStatsRange(int[] lo, int[] stats, int[] hi) {

  // System.out.println("stats = " + Arrays.toString(stats) +": in range " + Arrays.toString(lo) + "..." + Arrays.toString(hi));

  for (SortStat stat : SortStat.values()) {

   int i = stat.ordinal();

   if (stats[i] < lo[i] || stats[i] > hi[i]) {

    assertFalse(stat + " stats = " + stats[i] + " out or required range [" + lo[i] + "," + hi[i] + "]", true);

   }

  }

 }

 protected int[] s(int g, int s, int c) {

  return new int[] {g, s, c};

 }

 protected Sorter sorter = getAlgorithm();

 SortHarness harness;

 SortObject object;

 protected abstract int[] lo(int n, boolean isAdd);

 protected abstract int[] hi(int n, boolean isAdd, int ni);

 public void test10() {

  harness = new SortHarness ("Hello");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  assertEquals("Hello", object.get(0));

  assertNull(sorter.violation(object, 0));

 }

 public void test20() {

  harness = new SortHarness (String.CASE_INSENSITIVE_ORDER, "Hello", "hello");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 1));

  assertNull(sorter.violation(object, 2));

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  String a1 = object.get(1);

  assertTrue("Wrong: " + a1, a1 == "Hello" || a1 == "hello");

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  String a0 = object.get(0);

  assertTrue("Wrong: " + a0, a0 == "Hello" || a0 == "hello");

  assertTrue("Duplicate: " + a0, a0 != a1);

  assertNull(sorter.violation(object, 0));

 }

 public void test21() {

  harness = new SortHarness ((s1,s2) -> s2.compareTo(s1), "Hello", "Bye");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 1));

  assertNull(sorter.violation(object, 2));

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  assertEquals("Bye", object.get(1));

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  assertEquals("Hello", object.get(0));

  assertNull(sorter.violation(object, 0));

 }

 public void test22() {

  harness = new SortHarness ("Hello", "Bye");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 0));

  assertNull(sorter.violation(object, 2));

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  assertEquals("Hello", object.get(1));

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  assertEquals("Bye", object.get(0));

  assertNull(sorter.violation(object, 0));

 }

 public void test30() {

  harness = new SortHarness (String.CASE_INSENSITIVE_ORDER, "Hello", "hello", "HELLO");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 1));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 2));

  assertNull(sorter.violation(object, 3));

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  String a2 = object.get(2);

  assertTrue(a2 == "Hello" || a2 == "hello" || a2 == "HELLO");

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  String a1 = object.get(1);

  assertTrue("Wrong: " + a1, a1 == "Hello" || a1 == "hello" || a1 == "HELLO");

  assertTrue("Duplicate: " + a1, a1 != a2);

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  String a0 = object.get(0);

  assertTrue("Wrong: " + a0, a0 == "Hello" || a0 == "hello" || a0 == "HELLO");

  assertTrue("Duplicate: " + a0, a1 != a0);

  assertTrue("Duplicate: " + a0, a2 != a0);

  assertNull(sorter.violation(object, 0));

 }

 public void test31() {

  harness = new SortHarness (String.CASE_INSENSITIVE_ORDER, "Hello", "hello", "Bye");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 1));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 0));

  assertNull(sorter.violation(object, 3));

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  String a2 = object.get(2);

  assertTrue("Wrong: " + a2, a2 == "Hello" || a2 == "hello");

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  String a1 = object.get(1);

  assertTrue("Wrong: " + a1, a1 == "Hello" || a1 == "hello");

  assertTrue("Duplicate: " + a1, a1 != a2);

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  String a0 = object.get(0);

  assertEquals("Bye", a0);

  assertNull(sorter.violation(object, 0));

 }

 public void test32() {

  harness = new SortHarness (String.CASE_INSENSITIVE_ORDER, "Hello", "hello", "world");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 1));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 2));

  assertNull(sorter.violation(object, 3));

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  assertEquals("world", object.get(2));

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  String a1 = object.get(1);

  assertTrue("Wrong: " + a1, a1 == "Hello" || a1 == "hello");

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  String a0 = object.get(0);

  assertTrue("Wrong: " + a0, a0 == "Hello" || a0 == "hello");

  assertTrue("Duplicate: " + a0, a1 != a0);

  assertNull(sorter.violation(object, 0));

 }

 public void test33() {

  harness = new SortHarness (String.CASE_INSENSITIVE_ORDER, "Well", "Hello", "hello");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 0));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 1));

  assertNull(sorter.violation(object, 3));

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  assertEquals("Well", object.get(2));

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  String a1 = object.get(1);

  assertTrue("Wrong: " + a1, a1 == "Hello" || a1 == "hello");

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  String a0 = object.get(0);

  assertTrue("Wrong: " + a0, a0 == "Hello" || a0 == "hello");

  assertTrue("Duplicate: " + a0, a1 != a0);

  assertNull(sorter.violation(object, 0));

 }

 public void test34() {

  harness = new SortHarness (String.CASE_INSENSITIVE_ORDER, "Hello", "and", "hello");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 0));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 2));

  assertNull(sorter.violation(object, 3));

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  String a2 = object.get(2);

  assertTrue("Wrong: " + a2, a2 == "Hello" || a2 == "hello");

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  String a1 = object.get(1);

  assertTrue("Wrong: " + a1, a1 == "Hello" || a1 == "hello");

  assertTrue("Duplicate: " + a1, a1 != a2);

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  String a0 = object.get(0);

  assertEquals("and", a0);

  assertNull(sorter.violation(object, 0));

 }

 public void test35() {

  harness = new SortHarness (String.CASE_INSENSITIVE_ORDER, "Hello", "and", "goodbye");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 0));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 1));

  assertNull(sorter.violation(object, 3));

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  assertEquals("Hello", object.get(2));

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  assertEquals("goodbye", object.get(1));

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  assertEquals("and", object.get(0));

  assertNull(sorter.violation(object, 0));

 }

 public void test36() {

  harness = new SortHarness ("Hello", "and", "goodbye"); // uppercase before lowercase

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 1));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 2));

  assertNull(sorter.violation(object, 3));

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  assertEquals("goodbye", object.get(2));

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  assertEquals("and", object.get(1));

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  assertEquals("Hello", object.get(0));

  assertNull(sorter.violation(object, 0));

 }

 public void test37() {

  harness = new SortHarness ("hello", "good", "world");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 0));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 2));

  assertNull(sorter.violation(object, 3));

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  assertEquals("world", object.get(2));

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  assertEquals("hello", object.get(1));

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  assertEquals("good", object.get(0));

  assertNull(sorter.violation(object, 0));

 }

 public void test38() {

  harness = new SortHarness ("hello", "good", "earth");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 0));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 0));

  assertNull(sorter.violation(object, 3));

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  assertEquals("hello", object.get(2));

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  assertEquals("good", object.get(1));

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  assertEquals("earth", object.get(0));

  assertNull(sorter.violation(object, 0));

 }

 public void test40() {

  harness = new SortHarness (String.CASE_INSENSITIVE_ORDER, "Beat", "beat", "BeAt", "BEAT");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 1));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 2));

  assertNull(sorter.violation(object, 3));

  harness.setSize(4);

  harness.clearStats();

  sorter.add(object, 3);

  assertStatsRange(lo(3,true), harness.getStats(), hi(3,true, 3));

  assertNull(sorter.violation(object, 4));

  harness.clearStats();

  sorter.remove(object, 3);

  assertStatsRange(lo(3,false), harness.getStats(), hi(3,false, 0));

  String a3 = object.get(3);

  assertTrue("Wrong: " + a3, a3 == "beat" || a3 == "Beat" || a3 == "BeAt" || a3 == "BEAT");

  assertNull(sorter.violation(object, 3));

  harness.setSize(3);

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  String a2 = object.get(2);

  assertTrue("Wrong: " + a2, a2 == "beat" || a2 == "Beat" || a2 == "BeAt" || a2 == "BEAT");

  assertTrue("Duplicate: " + a2, a2 != a3);

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  String a1 = object.get(1);

  assertTrue("Wrong: " + a1, a1 == "beat" || a1 == "Beat" || a1 == "BeAt" || a1 == "BEAT");

  assertTrue("Duplicate: " + a1, a1 != a3);

  assertTrue("Duplicate: " + a1, a1 != a2);

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  String a0 = object.get(0);

  assertTrue("Wrong: " + a0, a0 == "beat" || a0 == "Beat" || a0 == "BeAt" || a0 == "BEAT");

  assertTrue("Duplicate: " + a0, a0 != a3);

  assertTrue("Duplicate: " + a0, a0 != a2);

  assertTrue("Duplicate: " + a0, a0 != a1);

  assertNull(sorter.violation(object, 0));

 }

 public void test41() {

  harness = new SortHarness (String.CASE_INSENSITIVE_ORDER, "Beat", "drum", "beat", "DRUM");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 1));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 1));

  assertNull(sorter.violation(object, 3));

  harness.setSize(4);

  harness.clearStats();

  sorter.add(object, 3);

  assertStatsRange(lo(3,true), harness.getStats(), hi(3,true, 3));

  assertNull(sorter.violation(object, 4));

  harness.clearStats();

  sorter.remove(object, 3);

  assertStatsRange(lo(3,false), harness.getStats(), hi(3,false, 0));

  String a3 = object.get(3);

  assertTrue("Wrong: " + a3, a3 == "drum" || a3 == "DRUM");

  assertNull(sorter.violation(object, 3));

  harness.setSize(3);

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  String a2 = object.get(2);

  assertTrue("Wrong: " + a2, a2 == "drum" || a2 == "DRUM");

  assertTrue("Duplicate: " + a2, a2 != a3);

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  String a1 = object.get(1);

  assertTrue("Wrong: " + a1, a1 == "beat" || a1 == "Beat");

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  String a0 = object.get(0);

  assertTrue("Wrong: " + a0, a0 == "beat" || a0 == "Beat");

  assertTrue("Duplicate: " + a0, a0 != a1);

  assertNull(sorter.violation(object, 0));

 }

 public void test42() {

  harness = new SortHarness (String.CASE_INSENSITIVE_ORDER, "Beat", "drum", "in", "time");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 1));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 2));

  assertNull(sorter.violation(object, 3));

  harness.setSize(4);

  harness.clearStats();

  sorter.add(object, 3);

  assertStatsRange(lo(3,true), harness.getStats(), hi(3,true, 3));

  assertNull(sorter.violation(object, 4));

  harness.clearStats();

  sorter.remove(object, 3);

  assertStatsRange(lo(3,false), harness.getStats(), hi(3,false, 0));

  assertEquals("time", object.get(3));

  assertNull(sorter.violation(object, 3));

  harness.setSize(3);

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  assertEquals("in", object.get(2));

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  assertEquals("drum", object.get(1));

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  assertEquals("Beat", object.get(0));

  assertNull(sorter.violation(object, 0));

 }

 public void test43() {

  harness = new SortHarness (String.CASE_INSENSITIVE_ORDER, "Once", "upon", "a", "time");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 1));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 0));

  assertNull(sorter.violation(object, 3));

  harness.setSize(4);

  harness.clearStats();

  sorter.add(object, 3);

  assertStatsRange(lo(3,true), harness.getStats(), hi(3,true, 2));

  assertNull(sorter.violation(object, 4));

  harness.clearStats();

  sorter.remove(object, 3);

  assertStatsRange(lo(3,false), harness.getStats(), hi(3,false, 0));

  assertEquals("upon", object.get(3));

  assertNull(sorter.violation(object, 3));

  harness.setSize(3);

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  assertEquals("time", object.get(2));

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  assertEquals("Once", object.get(1));

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  assertEquals("a", object.get(0));

  assertNull(sorter.violation(object, 0));

 }

 public void test44() {

  harness = new SortHarness (String.CASE_INSENSITIVE_ORDER, "All", "in", "good", "time");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 1));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 1));

  assertNull(sorter.violation(object, 3));

  harness.setSize(4);

  harness.clearStats();

  sorter.add(object, 3);

  assertStatsRange(lo(3,true), harness.getStats(), hi(3,true, 3));

  assertNull(sorter.violation(object, 4));

  harness.clearStats();

  sorter.remove(object, 3);

  assertStatsRange(lo(3,false), harness.getStats(), hi(3,false, 0));

  assertEquals("time", object.get(3));

  assertNull(sorter.violation(object, 3));

  harness.setSize(3);

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  assertEquals("in", object.get(2));

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  assertEquals("good", object.get(1));

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  assertEquals("All", object.get(0));

  assertNull(sorter.violation(object, 0));

 }

 public void test50() {

  harness = new SortHarness (String.CASE_INSENSITIVE_ORDER, "A", "rose", "is", "a", "ROSE");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 1));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 1));

  assertNull(sorter.violation(object, 3));

  harness.setSize(4);

  harness.clearStats();

  sorter.add(object, 3);

  assertStatsRange(lo(3,true), harness.getStats(), hi(3,true, 1));

  assertNull(sorter.violation(object, 4));

  harness.setSize(5);

  harness.clearStats();

  sorter.add(object, 4);

  assertStatsRange(lo(4,true), harness.getStats(), hi(4,true, 4));

  assertNull(sorter.violation(object, 5));

  harness.clearStats();

  sorter.remove(object, 4);

  assertStatsRange(lo(4,false), harness.getStats(), hi(4,false, 0));

  String a4 = object.get(4);

  assertTrue("Wrong: " + a4, a4 == "rose" || a4 == "ROSE");

  assertNull(sorter.violation(object, 4));

  harness.setSize(4);

  harness.clearStats();

  sorter.remove(object, 3);

  assertStatsRange(lo(3,false), harness.getStats(), hi(3,false, 0));

  String a3 = object.get(3);

  assertTrue("Wrong: " + a3, a3 == "rose" || a3 == "ROSE");

  assertTrue("Duplicate: " + a3, a4 != a3);

  assertNull(sorter.violation(object, 3));

  harness.setSize(3);

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  assertEquals("is", object.get(2));

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  String a1 = object.get(1);

  assertTrue("Wrong: " + a1, a1 == "A" || a1 == "a");

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  String a0 = object.get(0);

  assertTrue("Wrong: " + a0, a0 == "a" || a0 == "A");

  assertTrue("Duplicate: " + a0, a0 != a1);

  assertNull(sorter.violation(object, 0));

 }

 public void test51() {

  harness = new SortHarness ("one", "two", "three", "four", "five");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 1));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 1));

  assertNull(sorter.violation(object, 3));

  harness.setSize(4);

  harness.clearStats();

  sorter.add(object, 3);

  assertStatsRange(lo(3,true), harness.getStats(), hi(3,true, 0));

  assertNull(sorter.violation(object, 4));

  harness.setSize(5);

  harness.clearStats();

  sorter.add(object, 4);

  assertStatsRange(lo(4,true), harness.getStats(), hi(4,true, 0));

  assertNull(sorter.violation(object, 5));

  harness.clearStats();

  sorter.remove(object, 4);

  assertStatsRange(lo(4,false), harness.getStats(), hi(4,false, 0));

  assertEquals("two", object.get(4));

  assertNull(sorter.violation(object, 4));

  harness.setSize(4);

  harness.clearStats();

  sorter.remove(object, 3);

  assertStatsRange(lo(3,false), harness.getStats(), hi(3,false, 0));

  assertEquals("three", object.get(3));

  assertNull(sorter.violation(object, 3));

  harness.setSize(3);

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  assertEquals("one", object.get(2));

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  assertEquals("four", object.get(1));

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  assertEquals("five", object.get(0));

  assertNull(sorter.violation(object, 0));

 }

 public void test52() {

  harness = new SortHarness ("1", "2", "3", "4", "5");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 1));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 2));

  assertNull(sorter.violation(object, 3));

  harness.setSize(4);

  harness.clearStats();

  sorter.add(object, 3);

  assertStatsRange(lo(3,true), harness.getStats(), hi(3,true, 3));

  assertNull(sorter.violation(object, 4));

  harness.setSize(5);

  harness.clearStats();

  sorter.add(object, 4);

  assertStatsRange(lo(4,true), harness.getStats(), hi(4,true, 4));

  assertNull(sorter.violation(object, 5));

  harness.clearStats();

  sorter.remove(object, 4);

  assertStatsRange(lo(4,false), harness.getStats(), hi(4,false, 0));

  assertEquals("5", object.get(4));

  assertNull(sorter.violation(object, 4));

  harness.setSize(4);

  harness.clearStats();

  sorter.remove(object, 3);

  assertStatsRange(lo(3,false), harness.getStats(), hi(3,false, 0));

  assertEquals("4", object.get(3));

  assertNull(sorter.violation(object, 3));

  harness.setSize(3);

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  assertEquals("3", object.get(2));

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  assertEquals("2", object.get(1));

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  assertEquals("1", object.get(0));

  assertNull(sorter.violation(object, 0));

 }

 public void test60() {

  harness = new SortHarness (String.CASE_INSENSITIVE_ORDER,

    "To", "be", "or", "not", "to", "BE");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 0));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 1));

  assertNull(sorter.violation(object, 3));

  harness.setSize(4);

  harness.clearStats();

  sorter.add(object, 3);

  assertStatsRange(lo(3,true), harness.getStats(), hi(3,true, 1));

  assertNull(sorter.violation(object, 4));

  harness.setSize(5);

  harness.clearStats();

  sorter.add(object, 4);

  assertStatsRange(lo(4,true), harness.getStats(), hi(4,true, 4));

  assertNull(sorter.violation(object, 5));

  harness.setSize(6);

  harness.clearStats();

  sorter.add(object, 5);

  assertStatsRange(lo(5,true), harness.getStats(), hi(5,true, 1));

  assertNull(sorter.violation(object, 6));

  harness.clearStats();

  sorter.remove(object, 5);

  assertStatsRange(lo(5,false), harness.getStats(), hi(5,false, 0));

  String a5 = object.get(5);

  assertTrue("Wrong: " + a5, a5 == "To" || a5 == "to");

  assertNull(sorter.violation(object, 5));

  harness.setSize(5);

  harness.clearStats();

  sorter.remove(object, 4);

  assertStatsRange(lo(4,false), harness.getStats(), hi(4,false, 0));

  String a4 = object.get(4);

  assertTrue("Wrong: " + a4, a4 == "To" || a4 == "to");

  assertTrue("Duplicate: " + a4, a4 != a5);

  assertNull(sorter.violation(object, 4));

  harness.setSize(4);

  harness.clearStats();

  sorter.remove(object, 3);

  assertStatsRange(lo(3,false), harness.getStats(), hi(3,false, 0));

  assertEquals("or", object.get(3));

  assertNull(sorter.violation(object, 3));

  harness.setSize(3);

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  assertEquals("not", object.get(2));

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  String a1 = object.get(1);

  assertTrue("Wrong: " + a1, a1 == "be" || a1 == "BE");

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  String a0 = object.get(0);

  assertTrue("Wrong: " + a0, a0 == "be" || a0 == "BE");

  assertTrue("Duplicate: " + a0, a0 != a1);

  assertNull(sorter.violation(object, 0));

 }

 public void test61() {

  harness = new SortHarness ("uno", "dos", "tres", "cuatro", "cinco", "seis");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 0));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 1));

  assertNull(sorter.violation(object, 3));

  harness.setSize(4);

  harness.clearStats();

  sorter.add(object, 3);

  assertStatsRange(lo(3,true), harness.getStats(), hi(3,true, 0));

  assertNull(sorter.violation(object, 4));

  harness.setSize(5);

  harness.clearStats();

  sorter.add(object, 4);

  assertStatsRange(lo(4,true), harness.getStats(), hi(4,true, 0));

  assertNull(sorter.violation(object, 5));

  harness.setSize(6);

  harness.clearStats();

  sorter.add(object, 5);

  assertStatsRange(lo(5,true), harness.getStats(), hi(5,true, 3));

  assertNull(sorter.violation(object, 6));

  harness.clearStats();

  sorter.remove(object, 5);

  assertStatsRange(lo(5,false), harness.getStats(), hi(5,false, 0));

  assertEquals("uno", object.get(5));

  assertNull(sorter.violation(object, 5));

  harness.setSize(5);

  harness.clearStats();

  sorter.remove(object, 4);

  assertStatsRange(lo(4,false), harness.getStats(), hi(4,false, 0));

  assertEquals("tres", object.get(4));

  assertNull(sorter.violation(object, 4));

  harness.setSize(4);

  harness.clearStats();

  sorter.remove(object, 3);

  assertStatsRange(lo(3,false), harness.getStats(), hi(3,false, 0));

  assertEquals("seis", object.get(3));

  assertNull(sorter.violation(object, 3));

  harness.setSize(3);

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  assertEquals("dos", object.get(2));

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  assertEquals("cuatro", object.get(1));

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  assertEquals("cinco", object.get(0));

  assertNull(sorter.violation(object, 0));

 }

 public void test62() {

  harness = new SortHarness ("A", "B", "C", "D", "E", "F");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 1));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 2));

  assertNull(sorter.violation(object, 3));

  harness.setSize(4);

  harness.clearStats();

  sorter.add(object, 3);

  assertStatsRange(lo(3,true), harness.getStats(), hi(3,true, 3));

  assertNull(sorter.violation(object, 4));

  harness.setSize(5);

  harness.clearStats();

  sorter.add(object, 4);

  assertStatsRange(lo(4,true), harness.getStats(), hi(4,true, 4));

  assertNull(sorter.violation(object, 5));

  harness.setSize(6);

  harness.clearStats();

  sorter.add(object, 5);

  assertStatsRange(lo(5,true), harness.getStats(), hi(5,true, 5));

  assertNull(sorter.violation(object, 6));

  harness.clearStats();

  sorter.remove(object, 5);

  assertStatsRange(lo(5,false), harness.getStats(), hi(5,false, 0));

  assertEquals("F", object.get(5));

  assertNull(sorter.violation(object, 5));

  harness.setSize(5);

  harness.clearStats();

  sorter.remove(object, 4);

  assertStatsRange(lo(4,false), harness.getStats(), hi(4,false, 0));

  assertEquals("E", object.get(4));

  assertNull(sorter.violation(object, 4));

  harness.setSize(4);

  harness.clearStats();

  sorter.remove(object, 3);

  assertStatsRange(lo(3,false), harness.getStats(), hi(3,false, 0));

  assertEquals("D", object.get(3));

  assertNull(sorter.violation(object, 3));

  harness.setSize(3);

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  assertEquals("C", object.get(2));

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  assertEquals("B", object.get(1));

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  assertEquals("A", object.get(0));

  assertNull(sorter.violation(object, 0));

 }

 public void test63() {

  harness = new SortHarness (String.CASE_INSENSITIVE_ORDER, "A", "stitch", "in", "time", "saves", "nine");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 1));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 1));

  assertNull(sorter.violation(object, 3));

  harness.setSize(4);

  harness.clearStats();

  sorter.add(object, 3);

  assertStatsRange(lo(3,true), harness.getStats(), hi(3,true, 3));

  assertNull(sorter.violation(object, 4));

  harness.setSize(5);

  harness.clearStats();

  sorter.add(object, 4);

  assertStatsRange(lo(4,true), harness.getStats(), hi(4,true, 2));

  assertNull(sorter.violation(object, 5));

  harness.setSize(6);

  harness.clearStats();

  sorter.add(object, 5);

  assertStatsRange(lo(5,true), harness.getStats(), hi(5,true, 2));

  assertNull(sorter.violation(object, 6));

  harness.clearStats();

  sorter.remove(object, 5);

  assertStatsRange(lo(5,false), harness.getStats(), hi(5,false, 0));

  assertEquals("time", object.get(5));

  assertNull(sorter.violation(object, 5));

  harness.setSize(5);

  harness.clearStats();

  sorter.remove(object, 4);

  assertStatsRange(lo(4,false), harness.getStats(), hi(4,false, 0));

  assertEquals("stitch", object.get(4));

  assertNull(sorter.violation(object, 4));

  harness.setSize(4);

  harness.clearStats();

  sorter.remove(object, 3);

  assertStatsRange(lo(3,false), harness.getStats(), hi(3,false, 0));

  assertEquals("saves", object.get(3));

  assertNull(sorter.violation(object, 3));

  harness.setSize(3);

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  assertEquals("nine", object.get(2));

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  assertEquals("in", object.get(1));

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  assertEquals("A", object.get(0));

  assertNull(sorter.violation(object, 0));

 }

 public void test70() {

  harness = new SortHarness (String.CASE_INSENSITIVE_ORDER,

    "Bear", "with", "me", "not", "ME", "WITH", "BEAR");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 1));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 1));

  assertNull(sorter.violation(object, 3));

  harness.setSize(4);

  harness.clearStats();

  sorter.add(object, 3);

  assertStatsRange(lo(3,true), harness.getStats(), hi(3,true, 2));

  assertNull(sorter.violation(object, 4));

  harness.setSize(5);

  harness.clearStats();

  sorter.add(object, 4);

  assertStatsRange(lo(4,true), harness.getStats(), hi(4,true, 2));

  assertNull(sorter.violation(object, 5));

  harness.setSize(6);

  harness.clearStats();

  sorter.add(object, 5);

  assertStatsRange(lo(5,true), harness.getStats(), hi(5,true, 5));

  assertNull(sorter.violation(object, 6));

  harness.setSize(7);

  harness.clearStats();

  sorter.add(object, 6);

  assertStatsRange(lo(6,true), harness.getStats(), hi(6,true, 1));

  assertNull(sorter.violation(object, 7));

  harness.clearStats();

  sorter.remove(object, 6);

  assertStatsRange(lo(6,false), harness.getStats(), hi(6,false, 0));

  String a6 = object.get(6);

  assertTrue("Wrong: " + a6, a6 == "with" || a6 == "WITH");

  assertNull(sorter.violation(object, 6));

  harness.setSize(6);

  harness.clearStats();

  sorter.remove(object, 5);

  assertStatsRange(lo(5,false), harness.getStats(), hi(5,false, 0));

  String a5 = object.get(5);

  assertTrue("Wrong: " + a5, a5 == "with" || a5 == "WITH");

  assertTrue("Duplicate: " + a5, a6 != a5);

  assertNull(sorter.violation(object, 5));

  harness.setSize(5);

  harness.clearStats();

  sorter.remove(object, 4);

  assertStatsRange(lo(4,false), harness.getStats(), hi(4,false, 0));

  assertEquals("not", object.get(4));

  assertNull(sorter.violation(object, 4));

  harness.setSize(4);

  harness.clearStats();

  sorter.remove(object, 3);

  assertStatsRange(lo(3,false), harness.getStats(), hi(3,false, 0));

  String a3 = object.get(3);

  assertTrue("Wrong: " + a3, a3 == "me" || a3 == "ME");

  assertNull(sorter.violation(object, 3));

  harness.setSize(3);

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  String a2 = object.get(2);

  assertTrue("Wrong: " + a2, a2 == "me" || a2 == "ME");

  assertTrue("Duplicate: " + a2, a2 != a3);

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  String a1 = object.get(1);

  assertTrue("Wrong: " + a1, a1 == "Bear" || a1 == "BEAR");

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  String a0 = object.get(0);

  assertTrue("Wrong: " + a0, a0 == "Bear" || a0 == "BEAR");

  assertTrue("Duplicate: " + a0, a0 != a1);

  assertNull(sorter.violation(object, 0));

 }

 public void test71() {

  harness = new SortHarness ("yī", "èr", "sān", "sì", "wǔ", "liù", "qī");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 1));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 0));

  assertNull(sorter.violation(object, 3));

  harness.setSize(4);

  harness.clearStats();

  sorter.add(object, 3);

  assertStatsRange(lo(3,true), harness.getStats(), hi(3,true, 0));

  assertNull(sorter.violation(object, 4));

  harness.setSize(5);

  harness.clearStats();

  sorter.add(object, 4);

  assertStatsRange(lo(4,true), harness.getStats(), hi(4,true, 0));

  assertNull(sorter.violation(object, 5));

  harness.setSize(6);

  harness.clearStats();

  sorter.add(object, 5);

  assertStatsRange(lo(5,true), harness.getStats(), hi(5,true, 0));

  assertNull(sorter.violation(object, 6));

  harness.setSize(7);

  harness.clearStats();

  sorter.add(object, 6);

  assertStatsRange(lo(6,true), harness.getStats(), hi(6,true, 0));

  assertNull(sorter.violation(object, 7));

  harness.clearStats();

  sorter.remove(object, 6);

  assertStatsRange(lo(6,false), harness.getStats(), hi(6,false, 0));

  assertEquals("èr", object.get(6));

  assertNull(sorter.violation(object, 6));

  harness.setSize(6);

  harness.clearStats();

  sorter.remove(object, 5);

  assertStatsRange(lo(5,false), harness.getStats(), hi(5,false, 0));

  assertEquals("yī", object.get(5));

  assertNull(sorter.violation(object, 5));

  harness.setSize(5);

  harness.clearStats();

  sorter.remove(object, 4);

  assertStatsRange(lo(4,false), harness.getStats(), hi(4,false, 0));

  assertEquals("wǔ", object.get(4));

  assertNull(sorter.violation(object, 4));

  harness.setSize(4);

  harness.clearStats();

  sorter.remove(object, 3);

  assertStatsRange(lo(3,false), harness.getStats(), hi(3,false, 0));

  assertEquals("sān", object.get(3));

  assertNull(sorter.violation(object, 3));

  harness.setSize(3);

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  assertEquals("sì", object.get(2));

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  assertEquals("qī", object.get(1));

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  assertEquals("liù", object.get(0));

  assertNull(sorter.violation(object, 0));

 }

 public void test72() {

  harness = new SortHarness ("0", "00", "000", "0000", "00000", "000000", "0000000");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 1));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 2));

  assertNull(sorter.violation(object, 3));

  harness.setSize(4);

  harness.clearStats();

  sorter.add(object, 3);

  assertStatsRange(lo(3,true), harness.getStats(), hi(3,true, 3));

  assertNull(sorter.violation(object, 4));

  harness.setSize(5);

  harness.clearStats();

  sorter.add(object, 4);

  assertStatsRange(lo(4,true), harness.getStats(), hi(4,true, 4));

  assertNull(sorter.violation(object, 5));

  harness.setSize(6);

  harness.clearStats();

  sorter.add(object, 5);

  assertStatsRange(lo(5,true), harness.getStats(), hi(5,true, 5));

  assertNull(sorter.violation(object, 6));

  harness.setSize(7);

  harness.clearStats();

  sorter.add(object, 6);

  assertStatsRange(lo(6,true), harness.getStats(), hi(6,true, 6));

  assertNull(sorter.violation(object, 7));

  harness.clearStats();

  sorter.remove(object, 6);

  assertStatsRange(lo(6,false), harness.getStats(), hi(6,false, 0));

  assertEquals("0000000", object.get(6));

  assertNull(sorter.violation(object, 6));

  harness.setSize(6);

  harness.clearStats();

  sorter.remove(object, 5);

  assertStatsRange(lo(5,false), harness.getStats(), hi(5,false, 0));

  assertEquals("000000", object.get(5));

  assertNull(sorter.violation(object, 5));

  harness.setSize(5);

  harness.clearStats();

  sorter.remove(object, 4);

  assertStatsRange(lo(4,false), harness.getStats(), hi(4,false, 0));

  assertEquals("00000", object.get(4));

  assertNull(sorter.violation(object, 4));

  harness.setSize(4);

  harness.clearStats();

  sorter.remove(object, 3);

  assertStatsRange(lo(3,false), harness.getStats(), hi(3,false, 0));

  assertEquals("0000", object.get(3));

  assertNull(sorter.violation(object, 3));

  harness.setSize(3);

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  assertEquals("000", object.get(2));

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  assertEquals("00", object.get(1));

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  assertEquals("0", object.get(0));

  assertNull(sorter.violation(object, 0));

 }

 public void test80() {

  harness = new SortHarness (String.CASE_INSENSITIVE_ORDER,

    "A", "Rose", "is", "a", "rose", "IS", "a", "ROSE");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 1));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 1));

  assertNull(sorter.violation(object, 3));

  harness.setSize(4);

  harness.clearStats();

  sorter.add(object, 3);

  assertStatsRange(lo(3,true), harness.getStats(), hi(3,true, 1));

  assertNull(sorter.violation(object, 4));

  harness.setSize(5);

  harness.clearStats();

  sorter.add(object, 4);

  assertStatsRange(lo(4,true), harness.getStats(), hi(4,true, 4));

  assertNull(sorter.violation(object, 5));

  harness.setSize(6);

  harness.clearStats();

  sorter.add(object, 5);

  assertStatsRange(lo(5,true), harness.getStats(), hi(5,true, 2));

  assertNull(sorter.violation(object, 6));

  harness.setSize(7);

  harness.clearStats();

  sorter.add(object, 6);

  assertStatsRange(lo(6,true), harness.getStats(), hi(6,true, 2));

  assertNull(sorter.violation(object, 7));

  harness.setSize(8);

  harness.clearStats();

  sorter.add(object, 7);

  assertStatsRange(lo(7,true), harness.getStats(), hi(7,true, 7));

  assertNull(sorter.violation(object, 8));

  harness.clearStats();

  sorter.remove(object, 7);

  assertStatsRange(lo(7,false), harness.getStats(), hi(7,false, 0));

  String a7 = object.get(7);

  assertTrue("Wrong: " + a7, a7 == "Rose" || a7 == "rose" || a7 == "ROSE");

  assertNull(sorter.violation(object, 7));

  harness.setSize(7);

  harness.clearStats();

  sorter.remove(object, 6);

  assertStatsRange(lo(6,false), harness.getStats(), hi(6,false, 0));

  String a6 = object.get(6);

  assertTrue("Wrong: " + a6, a6 == "Rose" || a6 == "rose" || a6 == "ROSE");

  assertTrue("Duplicate: " + a6, a6 != a7);

  assertNull(sorter.violation(object, 6));

  harness.setSize(6);

  harness.clearStats();

  sorter.remove(object, 5);

  assertStatsRange(lo(5,false), harness.getStats(), hi(5,false, 0));

  String a5 = object.get(5);

  assertTrue("Wrong: " + a5, a5 == "Rose" || a5 == "rose" || a5 == "ROSE");

  assertTrue("Duplicate: " + a5, a6 != a5);

  assertTrue("Duplicate: " + a5, a7 != a5);

  assertNull(sorter.violation(object, 5));

  harness.setSize(5);

  harness.clearStats();

  sorter.remove(object, 4);

  assertStatsRange(lo(4,false), harness.getStats(), hi(4,false, 0));

  String a4 = object.get(4);

  assertTrue("Wrong: " + a4, a4 == "is" || a4 == "IS");

  assertNull(sorter.violation(object, 4));

  harness.setSize(4);

  harness.clearStats();

  sorter.remove(object, 3);

  assertStatsRange(lo(3,false), harness.getStats(), hi(3,false, 0));

  String a3 = object.get(3);

  assertTrue("Wrong: " + a3, a3 == "is" || a3 == "IS");

  assertTrue("Duplicate: " + a3, a3 != a4);

  assertNull(sorter.violation(object, 3));

  harness.setSize(3);

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  String a2 = object.get(2);

  assertTrue("Wrong: " + a2, a2 == "A" || a2 == "a");

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  String a1 = object.get(1);

  assertTrue("Wrong: " + a1, a1 == "A" || a1 == "a");

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  String a0 = object.get(0);

  assertTrue("Wrong: " + a0, a0 == "A" || a0 == "a");

  assertNull(sorter.violation(object, 0));

 }

 public void test81() {

  harness = new SortHarness ("un", "deux", "trois", "quatre", "cinq", "six", "sept", "huit");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 0));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 1));

  assertNull(sorter.violation(object, 3));

  harness.setSize(4);

  harness.clearStats();

  sorter.add(object, 3);

  assertStatsRange(lo(3,true), harness.getStats(), hi(3,true, 1));

  assertNull(sorter.violation(object, 4));

  harness.setSize(5);

  harness.clearStats();

  sorter.add(object, 4);

  assertStatsRange(lo(4,true), harness.getStats(), hi(4,true, 0));

  assertNull(sorter.violation(object, 5));

  harness.setSize(6);

  harness.clearStats();

  sorter.add(object, 5);

  assertStatsRange(lo(5,true), harness.getStats(), hi(5,true, 3));

  assertNull(sorter.violation(object, 6));

  harness.setSize(7);

  harness.clearStats();

  sorter.add(object, 6);

  assertStatsRange(lo(6,true), harness.getStats(), hi(6,true, 3));

  assertNull(sorter.violation(object, 7));

  harness.setSize(8);

  harness.clearStats();

  sorter.add(object, 7);

  assertStatsRange(lo(7,true), harness.getStats(), hi(7,true, 2));

  assertNull(sorter.violation(object, 8));

  harness.clearStats();

  sorter.remove(object, 7);

  assertStatsRange(lo(7,false), harness.getStats(), hi(7,false, 0));

  assertEquals("un", object.get(7));

  assertNull(sorter.violation(object, 7));

  harness.setSize(7);

  harness.clearStats();

  sorter.remove(object, 6);

  assertStatsRange(lo(6,false), harness.getStats(), hi(6,false, 0));

  assertEquals("trois", object.get(6));

  assertNull(sorter.violation(object, 6));

  harness.setSize(6);

  harness.clearStats();

  sorter.remove(object, 5);

  assertStatsRange(lo(5,false), harness.getStats(), hi(5,false, 0));

  assertEquals("six", object.get(5));

  assertNull(sorter.violation(object, 5));

  harness.setSize(5);

  harness.clearStats();

  sorter.remove(object, 4);

  assertStatsRange(lo(4,false), harness.getStats(), hi(4,false, 0));

  assertEquals("sept", object.get(4));

  assertNull(sorter.violation(object, 4));

  harness.setSize(4);

  harness.clearStats();

  sorter.remove(object, 3);

  assertStatsRange(lo(3,false), harness.getStats(), hi(3,false, 0));

  assertEquals("quatre", object.get(3));

  assertNull(sorter.violation(object, 3));

  harness.setSize(3);

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  assertEquals("huit", object.get(2));

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  assertEquals("deux", object.get(1));

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  assertEquals("cinq", object.get(0));

  assertNull(sorter.violation(object, 0));

 }

 public void test82() {

  harness = new SortHarness ("a", "b", "c", "d", "e", "f", "g", "h");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 1));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 2));

  assertNull(sorter.violation(object, 3));

  harness.setSize(4);

  harness.clearStats();

  sorter.add(object, 3);

  assertStatsRange(lo(3,true), harness.getStats(), hi(3,true, 3));

  assertNull(sorter.violation(object, 4));

  harness.setSize(5);

  harness.clearStats();

  sorter.add(object, 4);

  assertStatsRange(lo(4,true), harness.getStats(), hi(4,true, 4));

  assertNull(sorter.violation(object, 5));

  harness.setSize(6);

  harness.clearStats();

  sorter.add(object, 5);

  assertStatsRange(lo(5,true), harness.getStats(), hi(5,true, 5));

  assertNull(sorter.violation(object, 6));

  harness.setSize(7);

  harness.clearStats();

  sorter.add(object, 6);

  assertStatsRange(lo(6,true), harness.getStats(), hi(6,true, 6));

  assertNull(sorter.violation(object, 7));

  harness.setSize(8);

  harness.clearStats();

  sorter.add(object, 7);

  assertStatsRange(lo(7,true), harness.getStats(), hi(7,true, 7));

  assertNull(sorter.violation(object, 8));

  harness.clearStats();

  sorter.remove(object, 7);

  assertStatsRange(lo(7,false), harness.getStats(), hi(7,false, 0));

  assertEquals("h", object.get(7));

  assertNull(sorter.violation(object, 7));

  harness.setSize(7);

  harness.clearStats();

  sorter.remove(object, 6);

  assertStatsRange(lo(6,false), harness.getStats(), hi(6,false, 0));

  assertEquals("g", object.get(6));

  assertNull(sorter.violation(object, 6));

  harness.setSize(6);

  harness.clearStats();

  sorter.remove(object, 5);

  assertStatsRange(lo(5,false), harness.getStats(), hi(5,false, 0));

  assertEquals("f", object.get(5));

  assertNull(sorter.violation(object, 5));

  harness.setSize(5);

  harness.clearStats();

  sorter.remove(object, 4);

  assertStatsRange(lo(4,false), harness.getStats(), hi(4,false, 0));

  assertEquals("e", object.get(4));

  assertNull(sorter.violation(object, 4));

  harness.setSize(4);

  harness.clearStats();

  sorter.remove(object, 3);

  assertStatsRange(lo(3,false), harness.getStats(), hi(3,false, 0));

  assertEquals("d", object.get(3));

  assertNull(sorter.violation(object, 3));

  harness.setSize(3);

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  assertEquals("c", object.get(2));

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  assertEquals("b", object.get(1));

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  assertEquals("a", object.get(0));

  assertNull(sorter.violation(object, 0));

 }

 public void test90() {

  harness = new SortHarness (String.CASE_INSENSITIVE_ORDER,

    "Don't", "count", "the", "days", "just", "make", "The", "Days", "COUNT");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 0));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 2));

  assertNull(sorter.violation(object, 3));

  harness.setSize(4);

  harness.clearStats();

  sorter.add(object, 3);

  assertStatsRange(lo(3,true), harness.getStats(), hi(3,true, 1));

  assertNull(sorter.violation(object, 4));

  harness.setSize(5);

  harness.clearStats();

  sorter.add(object, 4);

  assertStatsRange(lo(4,true), harness.getStats(), hi(4,true, 3));

  assertNull(sorter.violation(object, 5));

  harness.setSize(6);

  harness.clearStats();

  sorter.add(object, 5);

  assertStatsRange(lo(5,true), harness.getStats(), hi(5,true, 4));

  assertNull(sorter.violation(object, 6));

  harness.setSize(7);

  harness.clearStats();

  sorter.add(object, 6);

  assertStatsRange(lo(6,true), harness.getStats(), hi(6,true, 6));

  assertNull(sorter.violation(object, 7));

  harness.setSize(8);

  harness.clearStats();

  sorter.add(object, 7);

  assertStatsRange(lo(7,true), harness.getStats(), hi(7,true, 2));

  assertNull(sorter.violation(object, 8));

  harness.setSize(9);

  harness.clearStats();

  sorter.add(object, 8);

  assertStatsRange(lo(8,true), harness.getStats(), hi(8,true, 1));

  assertNull(sorter.violation(object, 9));

  harness.clearStats();

  sorter.remove(object, 8);

  assertStatsRange(lo(8,false), harness.getStats(), hi(8,false, 0));

  String a8 = object.get(8);

  assertTrue("Wrong: " + a8, a8 == "the" || a8 == "The");

  assertNull(sorter.violation(object, 8));

  harness.setSize(8);

  harness.clearStats();

  sorter.remove(object, 7);

  assertStatsRange(lo(7,false), harness.getStats(), hi(7,false, 0));

  String a7 = object.get(7);

  assertTrue("Wrong: " + a7, a7 == "the" || a7 == "The");

  assertTrue("Duplicate: " + a7, a8 != a7);

  assertNull(sorter.violation(object, 7));

  harness.setSize(7);

  harness.clearStats();

  sorter.remove(object, 6);

  assertStatsRange(lo(6,false), harness.getStats(), hi(6,false, 0));

  assertEquals("make", object.get(6));

  assertNull(sorter.violation(object, 6));

  harness.setSize(6);

  harness.clearStats();

  sorter.remove(object, 5);

  assertStatsRange(lo(5,false), harness.getStats(), hi(5,false, 0));

  assertEquals("just", object.get(5));

  assertNull(sorter.violation(object, 5));

  harness.setSize(5);

  harness.clearStats();

  sorter.remove(object, 4);

  assertStatsRange(lo(4,false), harness.getStats(), hi(4,false, 0));

  assertEquals("Don't", object.get(4));

  assertNull(sorter.violation(object, 4));

  harness.setSize(4);

  harness.clearStats();

  sorter.remove(object, 3);

  assertStatsRange(lo(3,false), harness.getStats(), hi(3,false, 0));

  String a3 = object.get(3);

  assertTrue("Wrong: " + a3, a3 == "days" || a3 == "Days");

  assertNull(sorter.violation(object, 3));

  harness.setSize(3);

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  String a2 = object.get(2);

  assertTrue("Wrong: " + a2, a2 == "days" || a2 == "Days");

  assertTrue("Duplicate: " + a2, a2 != a3);

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  String a1 = object.get(1);

  assertTrue("Wrong: " + a1, a1 == "count" || a1 == "COUNT");

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  String a0 = object.get(0);

  assertTrue("Wrong: " + a0, a0 == "count" || a0 == "COUNT");

  assertTrue("Duplicate: " + a0, a0 != a1);

  assertNull(sorter.violation(object, 0));

 }

 public void test91() {

  harness = new SortHarness (

    "eins", "zwei", "drei", "vier", "fünf", "sechs", "sieben", "acht", "neun");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 1));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 0));

  assertNull(sorter.violation(object, 3));

  harness.setSize(4);

  harness.clearStats();

  sorter.add(object, 3);

  assertStatsRange(lo(3,true), harness.getStats(), hi(3,true, 2));

  assertNull(sorter.violation(object, 4));

  harness.setSize(5);

  harness.clearStats();

  sorter.add(object, 4);

  assertStatsRange(lo(4,true), harness.getStats(), hi(4,true, 2));

  assertNull(sorter.violation(object, 5));

  harness.setSize(6);

  harness.clearStats();

  sorter.add(object, 5);

  assertStatsRange(lo(5,true), harness.getStats(), hi(5,true, 3));

  assertNull(sorter.violation(object, 6));

  harness.setSize(7);

  harness.clearStats();

  sorter.add(object, 6);

  assertStatsRange(lo(6,true), harness.getStats(), hi(6,true, 4));

  assertNull(sorter.violation(object, 7));

  harness.setSize(8);

  harness.clearStats();

  sorter.add(object, 7);

  assertStatsRange(lo(7,true), harness.getStats(), hi(7,true, 0));

  assertNull(sorter.violation(object, 8));

  harness.setSize(9);

  harness.clearStats();

  sorter.add(object, 8);

  assertStatsRange(lo(8,true), harness.getStats(), hi(8,true, 4));

  assertNull(sorter.violation(object, 9));

  harness.clearStats();

  sorter.remove(object, 8);

  assertStatsRange(lo(8,false), harness.getStats(), hi(8,false, 0));

  String a8 = object.get(8);

  assertEquals("zwei", a8);

  assertNull(sorter.violation(object, 8));

  harness.setSize(8);

  harness.clearStats();

  sorter.remove(object, 7);

  assertStatsRange(lo(7,false), harness.getStats(), hi(7,false, 0));

  String a7 = object.get(7);

  assertEquals("vier", a7);

  assertNull(sorter.violation(object, 7));

  harness.setSize(7);

  harness.clearStats();

  sorter.remove(object, 6);

  assertStatsRange(lo(6,false), harness.getStats(), hi(6,false, 0));

  assertEquals("sieben", object.get(6));

  assertNull(sorter.violation(object, 6));

  harness.setSize(6);

  harness.clearStats();

  sorter.remove(object, 5);

  assertStatsRange(lo(5,false), harness.getStats(), hi(5,false, 0));

  assertEquals("sechs", object.get(5));

  assertNull(sorter.violation(object, 5));

  harness.setSize(5);

  harness.clearStats();

  sorter.remove(object, 4);

  assertStatsRange(lo(4,false), harness.getStats(), hi(4,false, 0));

  assertEquals("neun", object.get(4));

  assertNull(sorter.violation(object, 4));

  harness.setSize(4);

  harness.clearStats();

  sorter.remove(object, 3);

  assertStatsRange(lo(3,false), harness.getStats(), hi(3,false, 0));

  String a3 = object.get(3);

  assertEquals("fünf", a3);

  assertNull(sorter.violation(object, 3));

  harness.setSize(3);

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  String a2 = object.get(2);

  assertEquals("eins", a2);

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  assertEquals("drei", object.get(1));

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  String a0 = object.get(0);

  assertEquals("acht", a0);

  assertNull(sorter.violation(object, 0));

 }

 public void test92() {

  harness = new SortHarness (

    "A1", "B2", "C3", "D4", "E5", "F6", "G7", "H8", "I9");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 1));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 2));

  assertNull(sorter.violation(object, 3));

  harness.setSize(4);

  harness.clearStats();

  sorter.add(object, 3);

  assertStatsRange(lo(3,true), harness.getStats(), hi(3,true, 3));

  assertNull(sorter.violation(object, 4));

  harness.setSize(5);

  harness.clearStats();

  sorter.add(object, 4);

  assertStatsRange(lo(4,true), harness.getStats(), hi(4,true, 4));

  assertNull(sorter.violation(object, 5));

  harness.setSize(6);

  harness.clearStats();

  sorter.add(object, 5);

  assertStatsRange(lo(5,true), harness.getStats(), hi(5,true, 5));

  assertNull(sorter.violation(object, 6));

  harness.setSize(7);

  harness.clearStats();

  sorter.add(object, 6);

  assertStatsRange(lo(6,true), harness.getStats(), hi(6,true, 6));

  assertNull(sorter.violation(object, 7));

  harness.setSize(8);

  harness.clearStats();

  sorter.add(object, 7);

  assertStatsRange(lo(7,true), harness.getStats(), hi(7,true, 7));

  assertNull(sorter.violation(object, 8));

  harness.setSize(9);

  harness.clearStats();

  sorter.add(object, 8);

  assertStatsRange(lo(8,true), harness.getStats(), hi(8,true, 8));

  assertNull(sorter.violation(object, 9));

  harness.clearStats();

  sorter.remove(object, 8);

  assertStatsRange(lo(8,false), harness.getStats(), hi(8,false, 0));

  String a8 = object.get(8);

  assertEquals("I9", a8);

  assertNull(sorter.violation(object, 8));

  harness.setSize(8);

  harness.clearStats();

  sorter.remove(object, 7);

  assertStatsRange(lo(7,false), harness.getStats(), hi(7,false, 0));

  String a7 = object.get(7);

  assertEquals("H8", a7);

  assertNull(sorter.violation(object, 7));

  harness.setSize(7);

  harness.clearStats();

  sorter.remove(object, 6);

  assertStatsRange(lo(6,false), harness.getStats(), hi(6,false, 0));

  assertEquals("G7", object.get(6));

  assertNull(sorter.violation(object, 6));

  harness.setSize(6);

  harness.clearStats();

  sorter.remove(object, 5);

  assertStatsRange(lo(5,false), harness.getStats(), hi(5,false, 0));

  assertEquals("F6", object.get(5));

  assertNull(sorter.violation(object, 5));

  harness.setSize(5);

  harness.clearStats();

  sorter.remove(object, 4);

  assertStatsRange(lo(4,false), harness.getStats(), hi(4,false, 0));

  assertEquals("E5", object.get(4));

  assertNull(sorter.violation(object, 4));

  harness.setSize(4);

  harness.clearStats();

  sorter.remove(object, 3);

  assertStatsRange(lo(3,false), harness.getStats(), hi(3,false, 0));

  String a3 = object.get(3);

  assertEquals("D4", a3);

  assertNull(sorter.violation(object, 3));

  harness.setSize(3);

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  String a2 = object.get(2);

  assertEquals("C3", a2);

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  assertEquals("B2", object.get(1));

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  String a0 = object.get(0);

  assertEquals("A1", a0);

  assertNull(sorter.violation(object, 0));

 }

 public void test93() {

  harness = new SortHarness (String.CASE_INSENSITIVE_ORDER,

    "In", "two", "days", "from", "now", "tomorrow", "will", "be", "yesterday");

  object = harness.sortObject();

  harness.setSize(0);

  assertNull(sorter.violation(object, 0));

  harness.setSize(1);

  harness.clearStats();

  sorter.add(object, 0);

  assertStatsRange(lo(0,true), harness.getStats(), hi(0,true, 0));

  assertNull(sorter.violation(object, 1));

  harness.setSize(2);

  harness.clearStats();

  sorter.add(object, 1);

  assertStatsRange(lo(1,true), harness.getStats(), hi(1,true, 1));

  assertNull(sorter.violation(object, 2));

  harness.setSize(3);

  harness.clearStats();

  sorter.add(object, 2);

  assertStatsRange(lo(2,true), harness.getStats(), hi(2,true, 0));

  assertNull(sorter.violation(object, 3));

  harness.setSize(4);

  harness.clearStats();

  sorter.add(object, 3);

  assertStatsRange(lo(3,true), harness.getStats(), hi(3,true, 1));

  assertNull(sorter.violation(object, 4));

  harness.setSize(5);

  harness.clearStats();

  sorter.add(object, 4);

  assertStatsRange(lo(4,true), harness.getStats(), hi(4,true, 3));

  assertNull(sorter.violation(object, 5));

  harness.setSize(6);

  harness.clearStats();

  sorter.add(object, 5);

  assertStatsRange(lo(5,true), harness.getStats(), hi(5,true, 4));

  assertNull(sorter.violation(object, 6));

  harness.setSize(7);

  harness.clearStats();

  sorter.add(object, 6);

  assertStatsRange(lo(6,true), harness.getStats(), hi(6,true, 6));

  assertNull(sorter.violation(object, 7));

  harness.setSize(8);

  harness.clearStats();

  sorter.add(object, 7);

  assertStatsRange(lo(7,true), harness.getStats(), hi(7,true, 0));

  assertNull(sorter.violation(object, 8));

  harness.setSize(9);

  harness.clearStats();

  sorter.add(object, 8);

  assertStatsRange(lo(8,true), harness.getStats(), hi(8,true, 8));

  assertNull(sorter.violation(object, 9));

  harness.clearStats();

  sorter.remove(object, 8);

  assertStatsRange(lo(8,false), harness.getStats(), hi(8,false, 0));

  String a8 = object.get(8);

  assertEquals("yesterday", a8);

  assertNull(sorter.violation(object, 8));

  harness.setSize(8);

  harness.clearStats();

  sorter.remove(object, 7);

  assertStatsRange(lo(7,false), harness.getStats(), hi(7,false, 0));

  String a7 = object.get(7);

  assertEquals("will", a7);

  assertNull(sorter.violation(object, 7));

  harness.setSize(7);

  harness.clearStats();

  sorter.remove(object, 6);

  assertStatsRange(lo(6,false), harness.getStats(), hi(6,false, 0));

  assertEquals("two", object.get(6));

  assertNull(sorter.violation(object, 6));

  harness.setSize(6);

  harness.clearStats();

  sorter.remove(object, 5);

  assertStatsRange(lo(5,false), harness.getStats(), hi(5,false, 0));

  assertEquals("tomorrow", object.get(5));

  assertNull(sorter.violation(object, 5));

  harness.setSize(5);

  harness.clearStats();

  sorter.remove(object, 4);

  assertStatsRange(lo(4,false), harness.getStats(), hi(4,false, 0));

  assertEquals("now", object.get(4));

  assertNull(sorter.violation(object, 4));

  harness.setSize(4);

  harness.clearStats();

  sorter.remove(object, 3);

  assertStatsRange(lo(3,false), harness.getStats(), hi(3,false, 0));

  String a3 = object.get(3);

  assertEquals("In", a3);

  assertNull(sorter.violation(object, 3));

  harness.setSize(3);

  harness.clearStats();

  sorter.remove(object, 2);

  assertStatsRange(lo(2,false), harness.getStats(), hi(2,false, 0));

  String a2 = object.get(2);

  assertEquals("from", a2);

  assertNull(sorter.violation(object, 2));

  harness.setSize(2);

  harness.clearStats();

  sorter.remove(object, 1);

  assertStatsRange(lo(1,false), harness.getStats(), hi(1,false, 0));

  assertEquals("days", object.get(1));

  assertNull(sorter.violation(object, 1));

  harness.setSize(1);

  harness.clearStats();

  sorter.remove(object, 0);

  assertStatsRange(lo(0,false), harness.getStats(), hi(0,false, 0));

  String a0 = object.get(0);

  assertEquals("be", a0);

  assertNull(sorter.violation(object, 0));

 }

 private static final int TEST_SIZE = 10;

 private static final int RANDOM_TESTS = 10000;

 protected String randomString(Random r) {

  return (""+(1000+r.nextInt(1000))).substring(1);

 }

 public void test99() {

  Random random = new Random();

  String[] subject = new String[TEST_SIZE];

  for (int test=0; test < RANDOM_TESTS; ++test) {

   for (int i=0; i < TEST_SIZE; ++i) {

    subject[i] = randomString(random);

   }

   System.out.println("Sorting: " + Arrays.toString(subject));

   harness = new SortHarness<>(subject.clone());

   object = harness.sortObject();

   harness.setSize(0);

   for (int i=0; i < TEST_SIZE; ++i) {

    assertNull(sorter.violation(object, i));

    harness.setSize(i+1);

    harness.clearStats();

    sorter.add(object, i);

    int count = 0;

    for (int j=0; j < i; ++j) {

     if (subject[j].compareTo(subject[i]) <= 0) ++count;

    }

    assertStatsRange(lo(i,true), harness.getStats(), hi(i,true, count));

   }

   assertNull(sorter.violation(object, TEST_SIZE));

   Arrays.sort(subject);

   for (int i=TEST_SIZE-1; i >= 0; --i) {

    harness.clearStats();

    sorter.remove(object, i);

    assertStatsRange(lo(i,false), harness.getStats(), hi(i,false, 0));

    assertEquals("Wrong entry for element " + i, subject[i], object.get(i));

    harness.setSize(i);

    assertNull(sorter.violation(object, i));

   }

  }

 }

}

TEST HEAP SORT

import edu.uwm.cs351.HeapSorter;

import edu.uwm.cs351.Sorter;

public class TestHeapSort extends AbstractTestSort {

 protected Sorter getAlgorithm() {

  return new HeapSorter<>();

 }

 @Override

 protected int[] lo(int n, boolean isAdd) {

  switch(n) {

  case 0: return s(0,0,0);

  case 1:

   if (isAdd) {

    return s(1,0,1);

   } else {

    return s(0,0,0);

   }

  case 2:

   return s(1,0,1);

  default:

   if (isAdd) {

    return s(1,0,1);

   } else {

    return s(1,0,2);

   }

  }

 }

 @Override

 protected int[] hi(int n, boolean isAdd, int ni) {

  int log = 0;

  for (int i=isAdd ? n+1 : n; i > 0; i/=2) {

   ++log;

  }

  switch (n) {

  case 0:

   if (isAdd) {

    return s(1,1,0);

   } else {

    return s(0,0,0);

   }

  default:

   if (isAdd) {

    return s(log,log,log-1);

   } else {

    return s(log*2, log+1, (log-1)*2);

   }

  }

 }

 public void testA() {

  setUp(42);

  assertNull(algorithm.violation(self, 0));

  assertNull(algorithm.violation(self, 1));

 }

 public void testB() {

  setUp(10,20);

  assertNull(algorithm.violation(self, 0));

  assertNull(algorithm.violation(self, 1));

  assertNotNull(algorithm.violation(self, 2));

 }

 public void testC() {

  setUp((a,b) -> b-a, 10, 20);

  assertNull(algorithm.violation(self, 0));

  assertNull(algorithm.violation(self, 1));

  assertNull(algorithm.violation(self, 2));

 }

 public void testD() {

  setUp(10,20,5);

  assertNull(algorithm.violation(self, 0));

  assertNull(algorithm.violation(self, 1));

  assertNotNull(algorithm.violation(self, 2));

  assertNotNull(algorithm.violation(self, 3));

 }

 public void testE() {

  setUp(10,5,15);

  assertNull(algorithm.violation(self, 0));

  assertNull(algorithm.violation(self, 1));

  assertNull(algorithm.violation(self, 2));

  assertNotNull(algorithm.violation(self, 3));

 }

 public void testF() {

  setUp((a,b)-> 0, 10,50,1000000);

  assertNull(algorithm.violation(self, 0));

  assertNull(algorithm.violation(self, 1));

  assertNull(algorithm.violation(self, 2));

  assertNull(algorithm.violation(self, 3));

 }

 public void testG() {

  setUp(10,5,7,6,4,5,2,1);

  assertNull(algorithm.violation(self, 0));

  assertNull(algorithm.violation(self, 1));

  assertNull(algorithm.violation(self, 2));

  assertNull(algorithm.violation(self, 3));

  assertNotNull(algorithm.violation(self, 4));

  assertNotNull(algorithm.violation(self, 5));

  assertNotNull(algorithm.violation(self, 6));

  assertNotNull(algorithm.violation(self, 7));

  assertNotNull(algorithm.violation(self, 8));

 }

 public void testH() {

  setUp(10,10,10,10,10,9,8,7,10,10,10,10,10);

  assertNull(algorithm.violation(self, 0));

  assertNull(algorithm.violation(self, 1));

  assertNull(algorithm.violation(self, 2));

  assertNull(algorithm.violation(self, 3));

  assertNull(algorithm.violation(self, 4));

  assertNull(algorithm.violation(self, 5));

  assertNull(algorithm.violation(self, 6));

  assertNull(algorithm.violation(self, 7));

  assertNull(algorithm.violation(self, 8));

  assertNull(algorithm.violation(self, 9));

  assertNull(algorithm.violation(self, 10));

  assertNull(algorithm.violation(self, 11));

  assertNotNull(algorithm.violation(self, 12));

  assertNotNull(algorithm.violation(self, 13));

 }

 public void testI() {

  setUp(100, 70, 40, 50, 60, 15, 35, 45, 55, 11, 13);

  assertNull(algorithm.violation(self, 0));

  assertNull(algorithm.violation(self, 1));

  assertNull(algorithm.violation(self, 2));

  assertNull(algorithm.violation(self, 3));

  assertNull(algorithm.violation(self, 4));

  assertNull(algorithm.violation(self, 5));

  assertNull(algorithm.violation(self, 6));

  assertNull(algorithm.violation(self, 7));

  assertNull(algorithm.violation(self, 8));

  assertNotNull(algorithm.violation(self, 9));

  assertNotNull(algorithm.violation(self, 10));

  assertNotNull(algorithm.violation(self, 11));

 }

 public void testJ() {

  setUp(100,80,90,60,70,85,75,50,40,65,55,77,82,68,54,42,48,30,35,61,58,51,57,72,63,62,74);

  assertNull(algorithm.violation(self, 0));

  assertNull(algorithm.violation(self, 1));

  assertNull(algorithm.violation(self, 2));

  assertNull(algorithm.violation(self, 3));

  assertNull(algorithm.violation(self, 4));

  assertNull(algorithm.violation(self, 5));

  assertNull(algorithm.violation(self, 6));

  assertNull(algorithm.violation(self, 7));

  assertNull(algorithm.violation(self, 8));

  assertNull(algorithm.violation(self, 9));

  assertNull(algorithm.violation(self, 10));

  assertNull(algorithm.violation(self, 11));

  assertNull(algorithm.violation(self, 12));

  assertNull(algorithm.violation(self, 13));

  assertNull(algorithm.violation(self, 14));

  assertNull(algorithm.violation(self, 15));

  assertNull(algorithm.violation(self, 16));

  assertNull(algorithm.violation(self, 17));

  assertNull(algorithm.violation(self, 18));

  assertNull(algorithm.violation(self, 19));

  assertNull(algorithm.violation(self, 20));

  assertNull(algorithm.violation(self, 21));

  assertNull(algorithm.violation(self, 22));

  assertNotNull(algorithm.violation(self, 23));

  assertNotNull(algorithm.violation(self, 24));

  assertNotNull(algorithm.violation(self, 25));

  assertNotNull(algorithm.violation(self, 26));

  assertNotNull(algorithm.violation(self, 27));

 }

}

TEST INSERTION SORT

import edu.uwm.cs351.InsertionSorter;

import edu.uwm.cs351.Sorter;

public class TestInsertionSort extends AbstractTestSort {

 protected Sorter getAlgorithm() {

  return new InsertionSorter<>();

 }

 @Override

 protected int[] lo(int n, boolean isAdd) {

  if (isAdd && n > 0) return s(1,0,1);

  return s(0,0,0);

 }

 @Override

 protected int[] hi(int n, boolean isAdd, int ni) {

  if (isAdd) return s((n-ni)+2,(n-ni)+1,(n-ni)+1);

  return s(0,0,0);

 }

 public void testA() {

  setUp(42);

  assertNull(algorithm.violation(self, 0));

  assertNull(algorithm.violation(self, 1));

 }

 public void testB() {

  setUp(10,20);

  assertNull(algorithm.violation(self, 0));

  assertNull(algorithm.violation(self, 1));

  assertNull(algorithm.violation(self, 2));

 }

 public void testC() {

  setUp(3,2,6);

  assertNull(algorithm.violation(self, 0));

  assertNull(algorithm.violation(self, 1));

  assertNotNull(algorithm.violation(self, 2));

  assertNotNull(algorithm.violation(self, 3));

 }

 public void testD() {

  setUp((a,b)->b-a, 3,2,6);

  assertNull(algorithm.violation(self, 0));

  assertNull(algorithm.violation(self, 1));

  assertNull(algorithm.violation(self, 2));

  assertNotNull(algorithm.violation(self, 3));

 }

 public void testE() {

  setUp((a,b)->0, 3,2,6);

  assertNull(algorithm.violation(self, 0));

  assertNull(algorithm.violation(self, 1));

  assertNull(algorithm.violation(self, 2));

  assertNull(algorithm.violation(self, 3));

 }

 public void testF() {

  setUp((a,b) -> a/10 - b/10, 4, 2, 15, 13, 9, 14);

  assertNull(algorithm.violation(self, 0));

  assertNull(algorithm.violation(self, 1));

  assertNull(algorithm.violation(self, 2));

  assertNull(algorithm.violation(self, 3));

  assertNull(algorithm.violation(self, 4));

  assertNotNull(algorithm.violation(self, 5));

  assertNotNull(algorithm.violation(self, 6));

 }

 public void testG() {

  setUp(4, 2, 13, 15, 19, 24, 33);

  assertNotNull(algorithm.violation(self, 5));

  assertNotNull(algorithm.violation(self, 6));

  assertNotNull(algorithm.violation(self, 7));

 }

 public void testH() {

  setUp((a,b)->0, 1, 3, 6, 10, 15, 10, 6, 3, 1);

  assertNull(algorithm.violation(self, 5));

  assertNull(algorithm.violation(self, 6));

  assertNull(algorithm.violation(self, 7));

  assertNull(algorithm.violation(self, 8));

  assertNull(algorithm.violation(self, 9));

 }

 public void testI() {

  setUp(1, 3, 9, 27, 81, 343, 1029, 3087, 9261);

  assertNull(algorithm.violation(self, 5));

  assertNull(algorithm.violation(self, 6));

  assertNull(algorithm.violation(self, 7));

  assertNull(algorithm.violation(self, 8));

  assertNull(algorithm.violation(self, 9));

 }

 public void testJ() {

  setUp(1, 4, 16, -64, 256, 1024, 4096, 16384, 65536, 262144);

  assertNull(algorithm.violation(self, 0));

  assertNull(algorithm.violation(self, 1));

  assertNull(algorithm.violation(self, 2));

  assertNull(algorithm.violation(self, 3));

  assertNotNull(algorithm.violation(self, 8));

  assertNotNull(algorithm.violation(self, 10));

 }

}

TEST SELECTION SORT

import edu.uwm.cs351.SelectionSorter;

import edu.uwm.cs351.Sorter;

public class TestSelectionSort extends AbstractTestSort {

 protected Sorter getAlgorithm() {

  return new SelectionSorter<>();

 }

 @Override

 protected int[] lo(int n, boolean isAdd) {

  if (isAdd || n == 0) return s(0,0,0);

  return s(n+1,0,n);

 }

 @Override

 protected int[] hi(int n, boolean isAdd, int ni) {

  if (isAdd) return s(0,0,0);

  return s(n+1,2,n);

 }

 public void testA() {

  setUp(42);

  assertNull(algorithm.violation(self, 0));

  assertNull(algorithm.violation(self, 1));

 }

 public void testB() {

  setUp(10,20);

  assertNull(algorithm.violation(self, 0));

  assertNull(algorithm.violation(self, 1));

  assertNull(algorithm.violation(self, 2));

 }

 public void testC() {

  setUp(3,2,1);

  assertNull(algorithm.violation(self, 0));

  assertNull(algorithm.violation(self, 1));

  assertNull(algorithm.violation(self, 2));

  assertNull(algorithm.violation(self, 3));

 }

 public void testD() {

  setUp(1,6,3,-19);

  assertNull(algorithm.violation(self, 0));

  assertNull(algorithm.violation(self, 1));

  assertNull(algorithm.violation(self, 2));

  assertNull(algorithm.violation(self, 3));

  assertNull(algorithm.violation(self, 4));

 }

 public void testE() {

  setUp(1024,16,32,65536,512);

  assertNull(algorithm.violation(self, 0));

  assertNull(algorithm.violation(self, 1));

  assertNull(algorithm.violation(self, 2));

  assertNull(algorithm.violation(self, 3));

  assertNull(algorithm.violation(self, 4));

  assertNull(algorithm.violation(self, 5));

 }

 public void testF() {

  setUp(42,42,42,42,42,42);

  assertNull(algorithm.violation(self, 0));

  assertNull(algorithm.violation(self, 1));

  assertNull(algorithm.violation(self, 2));

  assertNull(algorithm.violation(self, 3));

  assertNull(algorithm.violation(self, 4));

  assertNull(algorithm.violation(self, 5));

  assertNull(algorithm.violation(self, 6));

 }

 public void testG() {

  setUp((a,b) -> b-a, 1,2,3,4,3,2,1);

  assertNull(algorithm.violation(self, 0));

  assertNull(algorithm.violation(self, 1));

  assertNull(algorithm.violation(self, 2));

  assertNull(algorithm.violation(self, 3));

  assertNull(algorithm.violation(self, 4));

  assertNull(algorithm.violation(self, 5));

  assertNull(algorithm.violation(self, 6));

  assertNull(algorithm.violation(self, 7));

 }

 public void testH() {

  setUp((a,b) -> 0, -587, 110, 1066, 1492, -185, 221, 33);

  assertNull(algorithm.violation(self, 0));

  assertNull(algorithm.violation(self, 1));

  assertNull(algorithm.violation(self, 2));

  assertNull(algorithm.violation(self, 3));

  assertNull(algorithm.violation(self, 4));

  assertNull(algorithm.violation(self, 5));

  assertNull(algorithm.violation(self, 6));

  assertNull(algorithm.violation(self, 7));

  assertNull(algorithm.violation(self, 8));

 }

 public void testI() {

  setUp(9, -8, 7, -6, 5, -4, 3, -2, 1);

  assertNull(algorithm.violation(self, 0));

  assertNull(algorithm.violation(self, 1));

  assertNull(algorithm.violation(self, 2));

  assertNull(algorithm.violation(self, 3));

  assertNull(algorithm.violation(self, 4));

  assertNull(algorithm.violation(self, 5));

  assertNull(algorithm.violation(self, 6));

  assertNull(algorithm.violation(self, 7));

  assertNull(algorithm.violation(self, 8));

  assertNull(algorithm.violation(self, 9));

 }

 public void testJ() {

  setUp(100,80,90,60,70,85,75,50,40,65,55,77,82,68,54,42,48,30,35,61,58,51,57,72,63,62,74);

  assertNull(algorithm.violation(self, 0));

  assertNull(algorithm.violation(self, 1));

  assertNull(algorithm.violation(self, 2));

  assertNull(algorithm.violation(self, 3));

  assertNull(algorithm.violation(self, 4));

  assertNull(algorithm.violation(self, 5));

  assertNull(algorithm.violation(self, 6));

  assertNull(algorithm.violation(self, 7));

  assertNull(algorithm.violation(self, 8));

  assertNull(algorithm.violation(self, 9));

  assertNull(algorithm.violation(self, 10));

  assertNull(algorithm.violation(self, 11));

  assertNull(algorithm.violation(self, 12));

  assertNull(algorithm.violation(self, 13));

  assertNull(algorithm.violation(self, 14));

  assertNull(algorithm.violation(self, 15));

  assertNull(algorithm.violation(self, 16));

  assertNull(algorithm.violation(self, 17));

  assertNull(algorithm.violation(self, 18));

  assertNull(algorithm.violation(self, 19));

  assertNull(algorithm.violation(self, 20));

  assertNull(algorithm.violation(self, 21));

  assertNull(algorithm.violation(self, 22));

  assertNull(algorithm.violation(self, 23));

  assertNull(algorithm.violation(self, 24));

  assertNull(algorithm.violation(self, 25));

  assertNull(algorithm.violation(self, 26));

  assertNull(algorithm.violation(self, 27));

 }

}

Related Samples

Discover our Java Assignment Samples for comprehensive solutions to diverse programming challenges. These examples cover core Java concepts, data structures, and algorithms, ensuring clarity and educational value. Ideal for students seeking practical guidance and a deeper understanding of Java programming to excel in their studies.