MinFunction.java

Go to the documentation of this file.
00001 package com.graphbuilder.math.func;
00002 
00006 public class MinFunction implements Function {
00007 
00008     public MinFunction() {}
00009 
00013     public double of(double[] d, int numParam) {
00014         if (numParam == 0)
00015             return Double.MIN_VALUE;
00016 
00017         double min = Double.MAX_VALUE;
00018 
00019         for (int i = 0; i < numParam; i++)
00020             if (d[i] < min)
00021                 min = d[i];
00022         return min;
00023     }
00024 
00028     public boolean acceptNumParam(int numParam) {
00029         return numParam >= 0;
00030     }
00031 
00032     public String toString() {
00033         return "min(x1, x2, ..., xn)";
00034     }
00035 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1