MaxFunction.java

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

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1