return compare(((ISortableEOModelObject) arg0).getName(), ((ISortableEOModelObject) arg1).getName());
int comparison = compare(((ISortableEOModelObject) arg0).getName(), ((ISortableEOModelObject) arg1).getName()); System.out.println("PropertyListComparator.compare: " + ((ISortableEOModelObject) arg0).getName() + "/" + ((ISortableEOModelObject) arg1).getName() + "=" + comparison); return comparison;
  public int compare(Object arg0, Object arg1) {    if (arg0 == null) {      return (arg1 == null) ? 0 : -1;    }    else if (arg1 == null) {      return 1;    }    else if (arg0 instanceof String && arg1 instanceof String) {      return ((String) arg0).compareTo(arg1);    }    else if (arg0 instanceof Number && arg1 instanceof Number) {      double d0 = ((Number) arg0).doubleValue();      double d1 = ((Number) arg1).doubleValue();      if (d0 > d1) {        return 1;      }      else if (d0 < d1) {        return -1;      }      return 0;    }    else if (arg0 instanceof Timestamp && arg1 instanceof Timestamp) {      return ((Timestamp) arg0).compareTo(arg1);    }    else if (arg0 instanceof ISortableEOModelObject && arg1 instanceof ISortableEOModelObject) {      return compare(((ISortableEOModelObject) arg0).getName(), ((ISortableEOModelObject) arg1).getName());    }    else if (arg0 instanceof Map && arg1 instanceof Map) {      Map dic0 = (Map) arg0;      Map dic1 = (Map) arg1;      Object key0 = dic0.get("name");      if (key0 == null) {        key0 = dic0.get("prototypeName");      }      Object key1 = dic1.get("name");      if (key1 == null) {        key1 = dic1.get("prototypeName");      }      if (key0 != null && key1 != null) {        return compare(key0, key1);      }      else if (key0 != key1) {        throw new IllegalArgumentException("no 'name' key for either: " + arg0 + " or " + arg1);      }      // if no "name" keys are present, compare the keys and values      Set allKeys0 = dic0.keySet();      Set allKeys1 = dic1.keySet();      Iterator allKeys0Iter = allKeys0.iterator();      Iterator allKeys1Iter = allKeys1.iterator();      while (allKeys0Iter.hasNext() && allKeys1Iter.hasNext()) {        key0 = allKeys0Iter.next();        key1 = allKeys1Iter.next();        int compareResult = compare(key0, key1);        if (compareResult != 0) {          return compareResult;        }        compareResult = compare(dic0.get(key0), dic1.get(key1));        if (compareResult != 0) {          return compareResult;        }      }      return compare(new Integer(allKeys0.size()), new Integer(allKeys1.size()));    }    else {      int compareResult = compare(arg0.getClass().getName(), arg1.getClass().getName());      if (compareResult != 0) {        return compareResult;      }      return arg0.toString().compareTo(arg1.toString());    }  }