1 package net.sf.openrocket.optimization.general;
3 import java.util.Collection;
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
11 * @author Sampo Niskanen <sampo.niskanen@iki.fi>
13 public interface ParallelFunctionCache extends FunctionCache {
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.
20 * @param points the points at which to evaluate the function.
22 public void compute(Collection<Point> points);
25 * Schedule function evaluation for the specified point. The point is
26 * added to the end of the computation queue.
28 * @param point the point at which to evaluate the function.
30 public void compute(Point point);
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)}.
36 * @param points the points to wait for.
37 * @throws InterruptedException if this thread or the computing thread was interrupted while waiting.
39 public void waitFor(Collection<Point> points) throws InterruptedException, OptimizationException;
42 * Wait for a point to be computed. After calling this method
43 * the function value is available by calling {@link #getValue(Point)}.
45 * @param point the point to wait for.
46 * @throws InterruptedException if this thread or the computing thread was interrupted while waiting.
47 * @throws OptimizationException
49 public void waitFor(Point point) throws InterruptedException, OptimizationException;
53 * Abort the computation of the specified points. If computation has ended,
54 * the result is stored in the function cache anyway.
56 * @param points the points to abort.
57 * @return a list of the points that have been computed anyway
59 public List<Point> abort(Collection<Point> points);
63 * Abort the computation of the specified point. If computation has ended,
64 * the result is stored in the function cache anyway.
66 * @param point the point to abort.
67 * @return <code>true</code> if the point has been computed anyway, <code>false</code> if not.
69 public boolean abort(Point point);