public int compare(Object o1, Object o2) {

    // Check if objects are of class Instructional Offering
    if (!(o1 instanceof ClassInstructor)) {
      throw new ClassCastException("o1 Class must be of type ClassInstructor");
    }
    if (!(o2 instanceof ClassInstructor)) {
      throw new ClassCastException("o2 Class must be of type ClassInstructor");
    }

    ClassInstructor ci1 = (ClassInstructor) o1;
    ClassInstructor ci2 = (ClassInstructor) o2;

    if (ci1.getUniqueId().equals(ci2.getUniqueId())) return 0;

    int cmp =
        Double.compare(ci1.isLead().booleanValue() ? 0 : 1, ci2.isLead().booleanValue() ? 0 : 1);
    if (cmp != 0) return cmp;

    if (compareBy == COMPARE_BY_LEAD || compareBy == COMPARE_BY_PCT_SHARE) {
      cmp = ci1.getPercentShare().compareTo(ci1.getPercentShare());
      if (cmp != 0) return cmp;
    }

    cmp = compareStrings(ci1.getInstructor().getLastName(), ci2.getInstructor().getLastName());
    if (cmp != 0) return cmp;
    cmp = compareStrings(ci1.getInstructor().getFirstName(), ci2.getInstructor().getFirstName());
    if (cmp != 0) return cmp;
    cmp = compareStrings(ci1.getInstructor().getMiddleName(), ci2.getInstructor().getMiddleName());
    if (cmp != 0) return cmp;

    return ci1.getInstructor().getUniqueId().compareTo(ci2.getInstructor().getUniqueId());
  }
  @Override
  protected CSVField csvBuildInstructor(PreferenceGroup prefGroup, boolean isEditable) {
    CSVField cell = createCell();

    if (prefGroup instanceof Class_) {
      Class_ aClass = (Class_) prefGroup;
      if (aClass.isDisplayInstructor()) {
        TreeSet sortedInstructors = new TreeSet(new InstructorComparator());
        sortedInstructors.addAll(aClass.getClassInstructors());
        for (Iterator i = sortedInstructors.iterator(); i.hasNext(); ) {
          ClassInstructor ci = (ClassInstructor) i.next();
          String label = ci.getInstructor().getName(getInstructorNameFormat());
          addText(cell, label, true);
        }
      }
    }

    return cell;
  }