svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.remoteclient / src / main / java / org / gvsig / remoteclient / taskplanning / IQueue.java @ 40769
History | View | Annotate | Download (2.96 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.remoteclient.taskplanning; |
25 |
|
26 |
import java.util.Vector; |
27 |
|
28 |
/**
|
29 |
* <p>
|
30 |
* You should write your own concrete Queue implementation to hold the tasks in
|
31 |
* a specific kind of queue.<br>
|
32 |
* </p>
|
33 |
* <p>
|
34 |
* Following the contract, you should also write a task planner that does what
|
35 |
* you desire. Task planners are a concrete class of the ITaskPlanner that would
|
36 |
* plannify which is the next, the previous,.. task to be done. However, if
|
37 |
* you don't want to write anything special, just guess a simple FIFO queue<br>
|
38 |
* </p>
|
39 |
*
|
40 |
* @author jaume dominguez faus - jaume.dominguez@iver.es
|
41 |
* @see ITaskPlanner
|
42 |
*/
|
43 |
public interface IQueue { |
44 |
|
45 |
/**
|
46 |
* Adds a new task to the queue. The place where the new task will be put its
|
47 |
* left to the concrete implementation of this interface.
|
48 |
* @param IRunnableTask task
|
49 |
*/
|
50 |
IRunnableTask put(IRunnableTask task); |
51 |
|
52 |
/**
|
53 |
* Returns the next task by calling the task planner's nextTask() method.
|
54 |
* @return IRunnableTask with the next task to be executed.
|
55 |
*/
|
56 |
IRunnableTask take(); |
57 |
|
58 |
/**
|
59 |
* Returns true if the Queue has no (more) jobs to do.
|
60 |
* @return
|
61 |
*/
|
62 |
boolean isEmpty();
|
63 |
|
64 |
/**
|
65 |
* Returns the task planner currently defined by this queue.
|
66 |
* @return ITaskPlanner
|
67 |
*/
|
68 |
ITaskPlanner getTaskPlanner(); |
69 |
|
70 |
/**
|
71 |
* Sets the TaskPlanner that will decide which of the tasks in the queue will
|
72 |
* be executed next. A null value should represent a FIFO planner.
|
73 |
* @param planner
|
74 |
*/
|
75 |
void setTaskPlanner(ITaskPlanner planner);
|
76 |
|
77 |
/**
|
78 |
* Causes the execution of this queue to be paused. The task currently in execution
|
79 |
* finishes and after it the planner will not issue more tasks until resume() is
|
80 |
* invoked.
|
81 |
*/
|
82 |
void pause();
|
83 |
|
84 |
/**
|
85 |
* Causes the execution of this queue to be resumed. The execution will continue
|
86 |
* with the next task issued by the planner. It has no effect if the queue was not
|
87 |
* paused yet.
|
88 |
*/
|
89 |
void resume();
|
90 |
|
91 |
/**
|
92 |
* Returns the set of tasks in a Vector (thread-safe).
|
93 |
* @return Vector containing the tasks in this queue.
|
94 |
*/
|
95 |
Vector getTasks();
|
96 |
} |