RoundFunction.java

Go to the documentation of this file.
00001 package com.graphbuilder.math.func;
00002 
00008 public class RoundFunction implements Function {
00009 
00010     public RoundFunction() {}
00011 
00017     public double of(double[] d, int numParam) {
00018         if (d[0] >= Long.MAX_VALUE || d[0] <= Long.MIN_VALUE)
00019             return d[0];
00020 
00021         return Math.round(d[0]);
00022     }
00023 
00027     public boolean acceptNumParam(int numParam) {
00028         return numParam == 1;
00029     }
00030 
00031     public String toString() {
00032         return "round(x)";
00033     }
00034 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1