enhanced motor handling, bug fixes, initial optimization code
[debian/openrocket] / src / net / sf / openrocket / optimization / FunctionCallable.java
1 package net.sf.openrocket.optimization;
2
3 import java.util.concurrent.Callable;
4
5 /**
6  * A Callable that computes the value of a function at a specific point.
7  * 
8  * @author Sampo Niskanen <sampo.niskanen@iki.fi>
9  */
10 public class FunctionCallable implements Callable<Double> {
11         
12         private final Function function;
13         private final Point point;
14         
15         /**
16          * Sole constructor.
17          * 
18          * @param function      the function to evaluate
19          * @param point         the point at which to evaluate the function
20          */
21         public FunctionCallable(Function function, Point point) {
22                 this.function = function;
23                 this.point = point;
24         }
25         
26         /**
27          * Evaluate the function and return the result.
28          */
29         @Override
30         public Double call() throws InterruptedException {
31                 return function.evaluate(point);
32         }
33         
34 }