/**
   * Returns true if <code>value</code> is between the min/max.
   *
   * @param wantsCCE If false, and a ClassCastException is thrown in comparing the values, the
   *     exception is consumed and false is returned.
   */
  boolean isValidValue(Object value, boolean wantsCCE) {
    Comparable min = getMinimum();

    try {
      if (min != null && min.compareTo(value) > 0) {
        return false;
      }
    } catch (ClassCastException cce) {
      if (wantsCCE) {
        throw cce;
      }
      return false;
    }

    Comparable max = getMaximum();
    try {
      if (max != null && max.compareTo(value) < 0) {
        return false;
      }
    } catch (ClassCastException cce) {
      if (wantsCCE) {
        throw cce;
      }
      return false;
    }
    return true;
  }
 public void addElement(Object o) {
   Comparable a = (Comparable) o;
   int i = 0;
   for (i = 0; i < getSize(); i++) {
     if (a.compareTo(getElementAt(i)) < 0) {
       break;
     }
   }
   super.add(i, o);
 }