Undo/redo system enhancements, DnD for component tree, bug fixes
[debian/openrocket] / 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 queuing 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          * Queue a list of function evaluations at the specified points.
17          * 
18          * @param points        the points at which to evaluate the function.
19          */
20         public void compute(Collection<Point> points);
21         
22         /**
23          * Queue function evaluation for the specified point.
24          * 
25          * @param point         the point at which to evaluate the function.
26          */
27         public void compute(Point point);
28         
29         /**
30          * Wait for a collection of points to be computed.  After calling this method
31          * the function values are available by calling XXX
32          * 
33          * @param points        the points to wait for.
34          * @throws InterruptedException         if this thread was interrupted while waiting.
35          */
36         public void waitFor(Collection<Point> points) throws InterruptedException;
37         
38         /**
39          * Wait for a point to be computed.  After calling this method
40          * the function values are available by calling XXX
41          * 
42          * @param point         the point to wait for.
43          * @throws InterruptedException         if this thread was interrupted while waiting.
44          */
45         public void waitFor(Point point) throws InterruptedException;
46         
47         
48         /**
49          * Abort the computation of the specified point.  If computation has ended,
50          * the result is stored in the function cache anyway.
51          * 
52          * @param points        the points to abort.
53          * @return                      a list of the points that have been computed anyway
54          */
55         public List<Point> abort(Collection<Point> points);
56         
57         
58         /**
59          * Abort the computation of the specified point.  If computation has ended,
60          * the result is stored in the function cache anyway.
61          * 
62          * @param point         the point to abort.
63          * @return                      <code>true</code> if the point has been computed anyway, <code>false</code> if not.
64          */
65         public boolean abort(Point point);
66 }