io.tiler.internal.queries.expressions.functions.MinFunction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tiler Show documentation
Show all versions of tiler Show documentation
Plugable dashboard framework
package io.tiler.internal.queries.expressions.functions;
import io.tiler.internal.queries.QueryContext;
import io.tiler.internal.queries.expressions.Expression;
import java.util.List;
public class MinFunction extends ListFunction {
private final Expression list;
public MinFunction(QueryContext queryContext, Expression list) {
super(queryContext, list, Number.class);
this.list = list;
}
public Expression list() {
return list;
}
@Override
public Object applyToList(List list) {
Double min = null;
for (Number value : list) {
double doubleValue = value.doubleValue();
if (min == null || doubleValue < min) {
min = doubleValue;
}
}
return min == null ? Double.NaN : min;
}
}