Mercurial > hg > jslab
comparison src/samer/silk/SilkFunction.java @ 0:bf79fb79ee13
Initial Mercurial check in.
author | samer |
---|---|
date | Tue, 17 Jan 2012 17:50:20 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:bf79fb79ee13 |
---|---|
1 package samer.silk; | |
2 | |
3 import java.util.*; | |
4 import jsint.*; | |
5 | |
6 public class SilkFunction extends samer.maths.Function { | |
7 Procedure fn; | |
8 | |
9 public SilkFunction(Procedure fn) { this.fn=fn; } | |
10 public double apply( double t) { | |
11 Object[] args = { new Double(t) }; | |
12 Object res = fn.apply(args); | |
13 return ((Number)res).doubleValue(); | |
14 } | |
15 | |
16 public String format( String arg) { return "("+fn.getName()+")"; } | |
17 } |