Revision 166,
1.4 KB
checked in by wojtekp, 13 years ago
(diff) |
|
-
Property svn:mime-type set to
text/plain
|
Line | |
---|
1 | package test.rewolucja.scheduling.queue; |
---|
2 | |
---|
3 | import gridsim.Gridlet; |
---|
4 | |
---|
5 | import java.util.ArrayList; |
---|
6 | |
---|
7 | import org.joda.time.DateTime; |
---|
8 | |
---|
9 | import test.rewolucja.GSSIMJobInterface; |
---|
10 | |
---|
11 | public class Queue extends ArrayList<GSSIMJobInterface<?>> implements QueueInterface<GSSIMJobInterface<?>>{ |
---|
12 | |
---|
13 | |
---|
14 | private static final long serialVersionUID = 6576299222910508209L; |
---|
15 | |
---|
16 | protected String name; |
---|
17 | protected int priority; |
---|
18 | protected boolean supportReservation; |
---|
19 | |
---|
20 | public Queue (boolean supportReservation){ |
---|
21 | name = "Queue"; |
---|
22 | priority = 0; |
---|
23 | this.supportReservation = supportReservation; |
---|
24 | } |
---|
25 | |
---|
26 | public boolean add(GSSIMJobInterface<?> job){ |
---|
27 | try { |
---|
28 | job.setStatus(Gridlet.QUEUED); |
---|
29 | } catch(Exception e){ |
---|
30 | throw new RuntimeException(e); |
---|
31 | } |
---|
32 | |
---|
33 | return super.add(job); |
---|
34 | } |
---|
35 | |
---|
36 | public void add(int pos, GSSIMJobInterface<?> job){ |
---|
37 | try { |
---|
38 | job.setStatus(Gridlet.QUEUED); |
---|
39 | } catch(Exception e){ |
---|
40 | throw new RuntimeException(e); |
---|
41 | } |
---|
42 | |
---|
43 | super.add(pos, job); |
---|
44 | } |
---|
45 | |
---|
46 | public DateTime getArrivalTime(int pos) throws IndexOutOfBoundsException { |
---|
47 | //return get(pos).getSubmissionTimeToBroker(); |
---|
48 | return null; |
---|
49 | } |
---|
50 | |
---|
51 | public String getName() { |
---|
52 | return name; |
---|
53 | } |
---|
54 | |
---|
55 | public int getPriority() { |
---|
56 | return priority; |
---|
57 | } |
---|
58 | |
---|
59 | public void setName(String name) { |
---|
60 | this.name = name; |
---|
61 | } |
---|
62 | |
---|
63 | public void setPriority(int priority) { |
---|
64 | this.priority = priority; |
---|
65 | } |
---|
66 | |
---|
67 | public boolean supportReservations() { |
---|
68 | return supportReservation; |
---|
69 | } |
---|
70 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.