EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.scheduler.queueing.runqueues]

COVERAGE SUMMARY FOR SOURCE FILE [AbstractRunQueue.java]

nameclass, %method, %block, %line, %
AbstractRunQueue.java0%   (0/1)0%   (0/12)0%   (0/150)0%   (0/25)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AbstractRunQueue0%   (0/1)0%   (0/12)0%   (0/150)0%   (0/25)
<static initializer> 0%   (0/1)0%   (0/8)0%   (0/1)
AbstractRunQueue (): void 0%   (0/1)0%   (0/8)0%   (0/3)
addProcess (IActiveProcess, boolean): void 0%   (0/1)0%   (0/8)0%   (0/3)
contains (IActiveProcess): boolean 0%   (0/1)0%   (0/13)0%   (0/1)
containsRunning (IActiveProcess): boolean 0%   (0/1)0%   (0/5)0%   (0/1)
getCurrentLoad (): int 0%   (0/1)0%   (0/11)0%   (0/3)
isEmpty (): boolean 0%   (0/1)0%   (0/7)0%   (0/1)
isIdle (IResourceInstance): boolean 0%   (0/1)0%   (0/15)0%   (0/2)
removeProcess (IActiveProcess): boolean 0%   (0/1)0%   (0/13)0%   (0/2)
removeRunning (IActiveProcess): void 0%   (0/1)0%   (0/26)0%   (0/3)
runningOn (IActiveProcess): IResourceInstance 0%   (0/1)0%   (0/6)0%   (0/1)
setRunningOn (IActiveProcess, IResourceInstance): void 0%   (0/1)0%   (0/30)0%   (0/4)

1package de.uka.ipd.sdq.scheduler.queueing.runqueues;
2 
3import java.util.Hashtable;
4import java.util.Map;
5 
6import de.uka.ipd.sdq.scheduler.processes.IActiveProcess;
7import de.uka.ipd.sdq.scheduler.queueing.IRunQueue;
8import de.uka.ipd.sdq.scheduler.resources.IResourceInstance;
9 
10public abstract class AbstractRunQueue implements IRunQueue {
11 
12        protected Map<IActiveProcess, IResourceInstance> running_on_table;
13 
14        protected AbstractRunQueue() {
15                running_on_table = new Hashtable<IActiveProcess, IResourceInstance>();
16        }
17 
18        public int getCurrentLoad() {
19                int running = running_on_table.size();
20                int waiting = numWaitingProcesses(); 
21                return running + waiting ;
22        }
23 
24        public boolean isEmpty() {
25                return getCurrentLoad() == 0;
26        }
27 
28        public boolean removeProcess(IActiveProcess process) {
29                return running_on_table.remove(process) != null
30                                || removePendingProcess(process);
31        }
32 
33        public boolean contains(IActiveProcess process) {
34                return running_on_table.containsKey(process) || containsPending(process);
35        }
36 
37        public void addProcess(IActiveProcess process, boolean inFront) {
38                process.setRunQueue(this);
39                addProcessToRunQueue(process,inFront);
40        }
41        
42        public boolean containsRunning(IActiveProcess process) {
43                return running_on_table.containsKey(process);
44        }
45        
46        public void removeRunning(IActiveProcess process) {
47                assert running_on_table.containsKey(process) : "Process '" + process + "' not running.";
48                running_on_table.remove(process);
49        }
50        
51        public void setRunningOn(IActiveProcess process, IResourceInstance instance) {
52                assert running_on_table.get(process) == null;
53                assert !running_on_table.values().contains(instance);
54                running_on_table.put(process, instance);
55        }
56        
57        public IResourceInstance runningOn(IActiveProcess process) {
58                return running_on_table.get(process);
59        }
60        
61        public boolean isIdle(IResourceInstance instance) {
62                return !instance.processAssigned() 
63                        && (running_on_table.size() > 1 || numWaitingProcesses() == 0);
64        }
65 
66        public abstract IActiveProcess getNextRunnableProcess(
67                        IResourceInstance instance);
68 
69        /**
70         * Template Method. Returns
71         * 
72         * @param process
73         * @return
74         */
75        public abstract boolean containsPending(IActiveProcess process);
76 
77        /**
78         * Template Method. Returns the number of processs waiting in the queue.
79         * 
80         * @return
81         */
82        protected abstract int numWaitingProcesses();
83 
84        /**
85         * Template method. Removes the given process from the queue.
86         * 
87         * @param process
88         */
89        public abstract boolean removePendingProcess(IActiveProcess process);
90 
91        /**
92         * Template method.
93         * 
94         * @param process
95         * @param inFront 
96         */
97        protected abstract void addProcessToRunQueue(IActiveProcess process, boolean inFront);
98 
99}

[all classes][de.uka.ipd.sdq.scheduler.queueing.runqueues]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov