private Object getRangeValue(Number domainValue) {
    ContinuousMappingPoint firstPoint = points.get(0);
    Number minDomain = firstPoint.getValue().doubleValue();

    //  if given domain value is smaller than any in our list,
    //  return the range value for the smallest domain value we have.
    int firstCmp = compareValues(domainValue, minDomain);

    if (firstCmp <= 0) {
      BoundaryRangeValues bv = firstPoint.getRange();

      if (firstCmp < 0) return bv.lesserValue;
      else return bv.equalValue;
    }

    //  if given domain value is larger than any in our Vector,
    //  return the range value for the largest domain value we have.
    ContinuousMappingPoint lastPoint = points.get(points.size() - 1);
    Number maxDomain = lastPoint.getValue().doubleValue();

    if (compareValues(domainValue, maxDomain) > 0) {
      BoundaryRangeValues bv = lastPoint.getRange();

      return bv.greaterValue;
    }

    //  OK, it's somewhere in the middle, so find the boundaries and
    //  pass to our interpolator function. First check for a null
    //  interpolator function
    if (this.interpolator == null) return null;

    // Note that the list of Points is sorted.
    // Also, the case of the inValue equalling the smallest key was
    // checked above.
    ContinuousMappingPoint currentPoint;
    int index = 0;

    for (index = 0; index < points.size(); index++) {
      currentPoint = points.get(index);

      Double currentValue = currentPoint.getValue().doubleValue();
      int cmpValue = compareValues(domainValue, currentValue);

      if (cmpValue == 0) {
        BoundaryRangeValues bv = currentPoint.getRange();

        return bv.equalValue;
      } else if (cmpValue < 0) break;
    }

    return getRangeValue(index, domainValue);
  }
  /**
   * This is tricky. The desired domain value is greater than lowerDomain and less than upperDomain.
   * Therefore, we want the "greater" field of the lower boundary value (because the desired domain
   * value is greater) and the "lesser" field of the upper boundary value (semantic difficulties).
   */
  private Object getRangeValue(int index, Number domainValue) {
    //  Get Lower Domain and Range
    ContinuousMappingPoint lowerBound = points.get(index - 1);
    Number lowerDomain = lowerBound.getValue().doubleValue();
    BoundaryRangeValues lv = lowerBound.getRange();
    Object lowerRange = lv.greaterValue;

    //  Get Upper Domain and Range
    ContinuousMappingPoint upperBound = points.get(index);
    Number upperDomain = upperBound.getValue().doubleValue();
    BoundaryRangeValues gv = upperBound.getRange();
    Object upperRange = gv.lesserValue;

    return interpolator.getRangeValue(
        lowerDomain, lowerRange, upperDomain, upperRange, domainValue);
  }