FactFunction.java
Go to the documentation of this file.00001 package com.graphbuilder.math.func;
00002
00006 public class FactFunction implements Function {
00007
00008 public FactFunction() {}
00009
00014 public double of(double[] d, int numParam) {
00015 int n = (int) d[0];
00016
00017 double result = 1;
00018
00019 for (int i = n; i > 1; i--)
00020 result *= i;
00021
00022 return result;
00023 }
00024
00028 public boolean acceptNumParam(int numParam) {
00029 return numParam == 1;
00030 }
00031
00032 public String toString() {
00033 return "fact(n)";
00034 }
00035 }