samer@0: package samer.silk; samer@0: samer@0: import java.util.*; samer@0: import jsint.*; samer@0: samer@0: public class SilkFunction extends samer.maths.Function { samer@0: Procedure fn; samer@0: samer@0: public SilkFunction(Procedure fn) { this.fn=fn; } samer@0: public double apply( double t) { samer@0: Object[] args = { new Double(t) }; samer@0: Object res = fn.apply(args); samer@0: return ((Number)res).doubleValue(); samer@0: } samer@0: samer@0: public String format( String arg) { return "("+fn.getName()+")"; } samer@0: }