SignFunction.java
Go to the documentation of this file.00001 package com.graphbuilder.math.func;
00002
00006 public class SignFunction implements Function {
00007
00008 public SignFunction() {}
00009
00013 public double of(double[] d, int numParam) {
00014 if (d[0] > 0) return 1;
00015 if (d[0] < 0) return -1;
00016 return 0;
00017 }
00018
00022 public boolean acceptNumParam(int numParam) {
00023 return numParam == 1;
00024 }
00025
00026 public String toString() {
00027 return "sign(x)";
00028 }
00029 }