svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.remoteclient / src / main / java / org / gvsig / remoteclient / taskplanning / IQueue.java @ 40559
History | View | Annotate | Download (3.3 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 |
/* CVS MESSAGES:
|
25 |
*
|
26 |
* $Id: IQueue.java 29670 2009-06-29 17:17:55Z jpiera $
|
27 |
* $Log$
|
28 |
* Revision 1.2 2006-05-16 17:10:27 jaume
|
29 |
* *** empty log message ***
|
30 |
*
|
31 |
* Revision 1.1 2006/05/12 07:15:45 jaume
|
32 |
* *** empty log message ***
|
33 |
*
|
34 |
* Revision 1.1 2006/05/11 17:18:06 jaume
|
35 |
* Un planificador, monitorizador, de descargas que trabaja en segundo plano
|
36 |
*
|
37 |
*
|
38 |
*/
|
39 |
package org.gvsig.remoteclient.taskplanning; |
40 |
|
41 |
import java.util.Vector; |
42 |
|
43 |
/**
|
44 |
* <p>
|
45 |
* You should write your own concrete Queue implementation to hold the tasks in
|
46 |
* a specific kind of queue.<br>
|
47 |
* </p>
|
48 |
* <p>
|
49 |
* Following the contract, you should also write a task planner that does what
|
50 |
* you desire. Task planners are a concrete class of the ITaskPlanner that would
|
51 |
* plannify which is the next, the previous,.. task to be done. However, if
|
52 |
* you don't want to write anything special, just guess a simple FIFO queue<br>
|
53 |
* </p>
|
54 |
*
|
55 |
* @author jaume dominguez faus - jaume.dominguez@iver.es
|
56 |
* @see ITaskPlanner
|
57 |
*/
|
58 |
public interface IQueue { |
59 |
|
60 |
/**
|
61 |
* Adds a new task to the queue. The place where the new task will be put its
|
62 |
* left to the concrete implementation of this interface.
|
63 |
* @param IRunnableTask task
|
64 |
*/
|
65 |
IRunnableTask put(IRunnableTask task); |
66 |
|
67 |
/**
|
68 |
* Returns the next task by calling the task planner's nextTask() method.
|
69 |
* @return IRunnableTask with the next task to be executed.
|
70 |
*/
|
71 |
IRunnableTask take(); |
72 |
|
73 |
/**
|
74 |
* Returns true if the Queue has no (more) jobs to do.
|
75 |
* @return
|
76 |
*/
|
77 |
boolean isEmpty();
|
78 |
|
79 |
/**
|
80 |
* Returns the task planner currently defined by this queue.
|
81 |
* @return ITaskPlanner
|
82 |
*/
|
83 |
ITaskPlanner getTaskPlanner(); |
84 |
|
85 |
/**
|
86 |
* Sets the TaskPlanner that will decide which of the tasks in the queue will
|
87 |
* be executed next. A null value should represent a FIFO planner.
|
88 |
* @param planner
|
89 |
*/
|
90 |
void setTaskPlanner(ITaskPlanner planner);
|
91 |
|
92 |
/**
|
93 |
* Causes the execution of this queue to be paused. The task currently in execution
|
94 |
* finishes and after it the planner will not issue more tasks until resume() is
|
95 |
* invoked.
|
96 |
*/
|
97 |
void pause();
|
98 |
|
99 |
/**
|
100 |
* Causes the execution of this queue to be resumed. The execution will continue
|
101 |
* with the next task issued by the planner. It has no effect if the queue was not
|
102 |
* paused yet.
|
103 |
*/
|
104 |
void resume();
|
105 |
|
106 |
/**
|
107 |
* Returns the set of tasks in a Vector (thread-safe).
|
108 |
* @return Vector containing the tasks in this queue.
|
109 |
*/
|
110 |
Vector getTasks();
|
111 |
} |