Mercurial > hg > jslab
diff src/samer/silk/SilkFunction.java @ 0:bf79fb79ee13
Initial Mercurial check in.
author | samer |
---|---|
date | Tue, 17 Jan 2012 17:50:20 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/samer/silk/SilkFunction.java Tue Jan 17 17:50:20 2012 +0000 @@ -0,0 +1,17 @@ +package samer.silk; + +import java.util.*; +import jsint.*; + +public class SilkFunction extends samer.maths.Function { + Procedure fn; + + public SilkFunction(Procedure fn) { this.fn=fn; } + public double apply( double t) { + Object[] args = { new Double(t) }; + Object res = fn.apply(args); + return ((Number)res).doubleValue(); + } + + public String format( String arg) { return "("+fn.getName()+")"; } +}