Added ternary versions of min and max.

This commit is contained in:
TomyLobo 2011-10-27 18:48:01 +02:00
parent ef5fba0f05
commit 9c070c323f

View File

@ -89,10 +89,18 @@ public final class Functions {
return Math.min(a.invoke(), b.invoke()); return Math.min(a.invoke(), b.invoke());
} }
public static final double min(Invokable a, Invokable b, Invokable c) throws Exception {
return Math.min(a.invoke(), Math.min(b.invoke(), c.invoke()));
}
public static final double max(Invokable a, Invokable b) throws Exception { public static final double max(Invokable a, Invokable b) throws Exception {
return Math.max(a.invoke(), b.invoke()); return Math.max(a.invoke(), b.invoke());
} }
public static final double max(Invokable a, Invokable b, Invokable c) throws Exception {
return Math.max(a.invoke(), Math.max(b.invoke(), c.invoke()));
}
public static final double ceil(Invokable x) throws Exception { public static final double ceil(Invokable x) throws Exception {
return Math.ceil(x.invoke()); return Math.ceil(x.invoke());