return "map(" + source.description() + "," + min + "," + max + "," + target.description() + ")";
}
@Override
public FunctionValues getValues(Map context, AtomicReaderContext readerContext) throws IOException {
final FunctionValues vals = source.getValues(context, readerContext);
final FunctionValues targets = target.getValues(context, readerContext);
final FunctionValues defaults = (this.defaultVal == null) ? null : defaultVal.getValues(context, readerContext);
return new FloatDocValues(this) {
@Override
public float floatVal(int doc) {
float val = vals.floatVal(doc);
return (val>=min && val<=max) ? targets.floatVal(doc) : (defaultVal == null ? val : defaults.floatVal(doc));
}
@Override
public String toString(int doc) {
return "map(" + vals.toString(doc) + ",min=" + min + ",max=" + max + ",target=" + targets.toString(doc) + ")";
}