Revision 104,
1.0 KB
checked in by wojtekp, 13 years ago
(diff) |
|
-
Property svn:mime-type set to
text/plain
|
Line | |
---|
1 | package simulator.lists.slotList; |
---|
2 | |
---|
3 | import schedframe.scheduling.TimeResourceAllocation; |
---|
4 | import schedframe.scheduling.utils.ResourceParameterName; |
---|
5 | |
---|
6 | /** |
---|
7 | * |
---|
8 | * @author Marcin Krystek |
---|
9 | * |
---|
10 | */ |
---|
11 | public class ResOptIterator implements SlotsGanttIterator{ |
---|
12 | |
---|
13 | protected SlotsGantt list; |
---|
14 | protected int currentPosition; |
---|
15 | |
---|
16 | public void visit(SlotsGantt list) { |
---|
17 | this.list = list; |
---|
18 | this.currentPosition = 0; |
---|
19 | } |
---|
20 | |
---|
21 | public boolean hasNext() { |
---|
22 | if(this.currentPosition < this.list.size()) |
---|
23 | return true; |
---|
24 | else |
---|
25 | return false; |
---|
26 | } |
---|
27 | |
---|
28 | public TimeResourceAllocation next() { |
---|
29 | TimeResourceAllocation slot = null; |
---|
30 | |
---|
31 | try { |
---|
32 | while(this.currentPosition < list.size() && |
---|
33 | (slot = list.get(this.currentPosition++)).getAllocatedResource(). |
---|
34 | getResourceUnit(ResourceParameterName.CPUCOUNT).getFreeAmount() == 0); |
---|
35 | } catch (NoSuchFieldException e) { |
---|
36 | e.printStackTrace(); |
---|
37 | } |
---|
38 | return slot; |
---|
39 | } |
---|
40 | |
---|
41 | public void remove() { |
---|
42 | throw new RuntimeException("Removing object by " + this.getClass() +" is not supported."); |
---|
43 | } |
---|
44 | |
---|
45 | public void resert(){ |
---|
46 | this.currentPosition = 0; |
---|
47 | } |
---|
48 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.