/**
   * Compare this table to another table. Results are based on 1: identity, 2: table name, 3: schema
   * name
   *
   * <p>This implementation was put in place to deal with analyzing multiple schemas that contain
   * identically named tables.
   *
   * @see {@link Comparable#compareTo(Object)}
   */
  public int compareTo(Table other) {
    if (other == this) // fast way out
    return 0;

    int rc = getName().compareToIgnoreCase(other.getName());
    if (rc == 0) {
      // should only get here if we're dealing with cross-schema references (rare)
      String ours = getSchema();
      String theirs = other.getSchema();
      if (ours != null && theirs != null) rc = ours.compareToIgnoreCase(theirs);
      else if (ours == null) rc = -1;
      else rc = 1;
    }

    return rc;
  }