create changelog entry
[debian/openrocket] / core / src / net / sf / openrocket / optimization / general / ParallelFunctionCache.java
1 package net.sf.openrocket.optimization.general;
2
3 import java.util.Collection;
4 import java.util.List;
5
6 /**
7  * A FunctionCache that allows scheduling points to be computed in the background,
8  * waiting for specific points to become computed or aborting the computation of
9  * points.
10  * 
11  * @author Sampo Niskanen <sampo.niskanen@iki.fi>
12  */
13 public interface ParallelFunctionCache extends FunctionCache {
14         
15         /**
16          * Schedule a list of function evaluations at the specified points.
17          * The points are added to the end of the computation queue in the order
18          * they are returned by the iterator.
19          * 
20          * @param points        the points at which to evaluate the function.
21          */
22         public void compute(Collection<Point> points);
23         
24         /**
25          * Schedule function evaluation for the specified point.  The point is
26          * added to the end of the computation queue.
27          * 
28          * @param point         the point at which to evaluate the function.
29          */
30         public void compute(Point point);
31         
32         /**
33          * Wait for a collection of points to be computed.  After calling this method
34          * the function values are available by calling {@link #getValue(Point)}.
35          * 
36          * @param points        the points to wait for.
37          * @throws InterruptedException         if this thread or the computing thread was interrupted while waiting.
38          * @throws OptimizationException        if an error preventing continuing the optimization occurs.
39          */
40         public void waitFor(Collection<Point> points) throws InterruptedException, OptimizationException;
41         
42         /**
43          * Wait for a point to be computed.  After calling this method
44          * the function value is available by calling {@link #getValue(Point)}.
45          * 
46          * @param point         the point to wait for.
47          * @throws InterruptedException         if this thread or the computing thread was interrupted while waiting.
48          * @throws OptimizationException        if an error preventing continuing the optimization occurs.
49          */
50         public void waitFor(Point point) throws InterruptedException, OptimizationException;
51         
52         
53         /**
54          * Abort the computation of the specified points.  If computation has ended,
55          * the result is stored in the function cache anyway.
56          * 
57          * @param points        the points to abort.
58          * @return                      a list of the points that have been computed anyway
59          */
60         public List<Point> abort(Collection<Point> points);
61         
62         
63         /**
64          * Abort the computation of the specified point.  If computation has ended,
65          * the result is stored in the function cache anyway.
66          * 
67          * @param point         the point to abort.
68          * @return                      <code>true</code> if the point has been computed anyway, <code>false</code> if not.
69          */
70         public boolean abort(Point point);
71         
72         
73         /**
74          * Abort the computation of all still unexecuted points.
75          */
76         public void abortAll();
77 }