public double scalar(Collection values) { double ret; CodeBlockTrace trace = new ScalarFunctionTrace(CODE, values).begin(); try { if (values == null || values.isEmpty()) return 0; // Get the max. value from the collection. Number min = null; Iterator it = values.iterator(); while (it.hasNext()) { Number n = (Number) it.next(); if (n == null) continue; if (min == null || n.doubleValue() < min.doubleValue()) min = n; } // Adjust to the specified precision. if (min == null) return 0; ret = round(min.doubleValue(), precission); } finally { trace.end(); } return ret; } }