@Override
  public int compareTo(Object o) {
    if (o instanceof CycNumber) {
      final CycNumber other = (CycNumber) o;
      final Class thisNumberClass = this.number.getClass();
      if (thisNumberClass.equals(other.number.getClass())
              && Comparable.class.isAssignableFrom(thisNumberClass)) {
        return ((Comparable)this.number).compareTo((Comparable)other.number);
      } else {
        return this.doubleValue().compareTo(other.doubleValue());
      }
    } else {
      throw new UnsupportedOperationException("Not supported yet.");
    }
  }