Mercurial > hg > jslab
annotate src/samer/silk/SilkFunction.java @ 8:5e3cbbf173aa tip
Reorganise some more
author | samer |
---|---|
date | Fri, 05 Apr 2019 22:41:58 +0100 |
parents | bf79fb79ee13 |
children |
rev | line source |
---|---|
samer@0 | 1 package samer.silk; |
samer@0 | 2 |
samer@0 | 3 import java.util.*; |
samer@0 | 4 import jsint.*; |
samer@0 | 5 |
samer@0 | 6 public class SilkFunction extends samer.maths.Function { |
samer@0 | 7 Procedure fn; |
samer@0 | 8 |
samer@0 | 9 public SilkFunction(Procedure fn) { this.fn=fn; } |
samer@0 | 10 public double apply( double t) { |
samer@0 | 11 Object[] args = { new Double(t) }; |
samer@0 | 12 Object res = fn.apply(args); |
samer@0 | 13 return ((Number)res).doubleValue(); |
samer@0 | 14 } |
samer@0 | 15 |
samer@0 | 16 public String format( String arg) { return "("+fn.getName()+")"; } |
samer@0 | 17 } |