/**
   * 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);
 }
 /**
  * Sets the maximum permissible value. If the <code>valueClass</code> has not been specified, and
  * <code>max</code> is non null, the <code>valueClass</code> will be set to that of the class of
  * <code>max</code>.
  *
  * @param max Maximum legal value that can be input
  * @see #setValueClass
  */
 public void setMaximum(Comparable max) {
   if (getValueClass() == null && max != null) {
     setValueClass(max.getClass());
   }
   this.max = max;
 }
 /**
  * Sets the minimum permissible value. If the <code>valueClass</code> has not been specified, and
  * <code>minimum</code> is non null, the <code>valueClass</code> will be set to that of the class
  * of <code>minimum</code>.
  *
  * @param minimum Minimum legal value that can be input
  * @see #setValueClass
  */
 public void setMinimum(Comparable minimum) {
   if (getValueClass() == null && minimum != null) {
     setValueClass(minimum.getClass());
   }
   min = minimum;
 }