class Interpolate2Real extends Interpolate<RealParameter, RealLiteral> implements RealParameter {

        @Override
        public Double getValue(ResultSet rs, long fid) throws ParameterException {

                double value = this.getLookupValue().getValue(rs, fid);

                if (getInterpolationPoint(0).getData() >= value) {
                        return getInterpolationPoint(0).getValue().getValue(rs, fid);
                }

                int numPt = getNumInterpolationPoint();
                if (getInterpolationPoint(numPt - 1).getData() <= value) {
                        return getInterpolationPoint(numPt - 1).getValue().getValue(rs, fid);
                }

                int k = getFirstIP(value);

                InterpolationPoint<RealParameter> ip1 = getInterpolationPoint(k);
                InterpolationPoint<RealParameter> ip2 = getInterpolationPoint(k + 1);

                switch (getMode()) {
                        case CUBIC:
                                return cubicInterpolation(ip1.getData(), ip2.getData(), value,
                                        ip1.getValue().getValue(rs, fid), ip2.getValue().getValue(rs, fid), -1.0, -1.0);
                        case COSINE:
                                return cosineInterpolation(ip1.getData(), ip2.getData(), value,
                                        ip1.getValue().getValue(rs, fid), ip2.getValue().getValue(rs, fid));
                        case LINEAR:
                                return linearInterpolation(ip1.getData(), ip2.getData(), value,
                                        ip1.getValue().getValue(rs, fid), ip2.getValue().getValue(rs, fid));

                }
                //as we've analyzed the three only possible cases in the switch,
                //we're not supposed to reach this point... 
                return 0.0;
        }

        public  Interpolate2Real(RealLiteral fallback);
        public  Interpolate2Real(InterpolateType expr);

}