Example #1
0
  @Override
  public int compareTo(Bound bound) {

    if (bound == null) {
      throw new InternalException("bound may not be null");
    }

    if (getClass() != bound.getClass()) {
      throw new InternalException("bound must have the same class");
    }

    if (this.value == null || bound.value == null) {
      if (this == MIN) {
        return bound == MIN ? 0 : -1;
      }

      if (this == MAX) {
        return bound == MAX ? 0 : 1;
      }

      if (bound == MIN) {
        return 1;
      }

      return -1;
    }

    return this.value.compareTo(bound.value);
  }