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

COVERAGE SUMMARY FOR SOURCE FILE [SimAbstractPassiveResource.java]

nameclass, %method, %block, %line, %
SimAbstractPassiveResource.java0%   (0/1)0%   (0/7)0%   (0/101)0%   (0/23)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SimAbstractPassiveResource0%   (0/1)0%   (0/7)0%   (0/101)0%   (0/23)
<static initializer> 0%   (0/1)0%   (0/8)0%   (0/1)
SimAbstractPassiveResource (SchedulerModel, int, String, String, IPriorityBoo... 0%   (0/1)0%   (0/18)0%   (0/5)
boostPriority (IRunningProcess): void 0%   (0/1)0%   (0/19)0%   (0/4)
fromRunningToWaiting (WaitingProcess, boolean): void 0%   (0/1)0%   (0/12)0%   (0/4)
fromWaitingToReady (WaitingProcess, IResourceInstance): void 0%   (0/1)0%   (0/12)0%   (0/4)
punish (IRunningProcess): void 0%   (0/1)0%   (0/19)0%   (0/4)
toString (): String 0%   (0/1)0%   (0/13)0%   (0/1)

1package de.uka.ipd.sdq.scheduler.resources.passive;
2 
3import java.util.ArrayDeque;
4import java.util.Deque;
5 
6import de.uka.ipd.sdq.scheduler.IPassiveResource;
7import de.uka.ipd.sdq.scheduler.IRunningProcess;
8import de.uka.ipd.sdq.scheduler.SchedulerModel;
9import de.uka.ipd.sdq.scheduler.priority.IPriorityBoost;
10import de.uka.ipd.sdq.scheduler.processes.impl.ProcessWithPriority;
11import de.uka.ipd.sdq.scheduler.resources.AbstractSimResource;
12import de.uka.ipd.sdq.scheduler.resources.IResourceInstance;
13import de.uka.ipd.sdq.scheduler.resources.active.SimActiveResource;
14 
15public abstract class SimAbstractPassiveResource extends AbstractSimResource
16                implements IPassiveResource {
17 
18        private IPriorityBoost priority_boost;
19        protected Deque<WaitingProcess> waiting_queue;
20        protected SimActiveResource main_resource;
21 
22        public SimAbstractPassiveResource(SchedulerModel model, int capacity, String name, String id,
23                        IPriorityBoost priority_boost, SimActiveResource managing_resource) {
24                super(model, capacity, name, id);
25                this.priority_boost = priority_boost;
26                this.main_resource = managing_resource;
27                this.waiting_queue = new ArrayDeque<WaitingProcess>();
28        }
29 
30        protected void fromWaitingToReady(WaitingProcess waiting_process,
31                        IResourceInstance current) {
32                if (main_resource != null){
33                        main_resource.getScheduler().fromWaitingToReady(waiting_process,
34                                        waiting_queue, current);
35                }
36        }
37 
38        protected void fromRunningToWaiting(WaitingProcess waiting_process,
39                        boolean inFront) {
40                if (main_resource != null) {
41                        main_resource.getScheduler().fromRunningToWaiting(waiting_process,
42                                        waiting_queue, inFront);
43                }
44        }
45 
46        protected void boostPriority(IRunningProcess process) {
47                if (priority_boost != null) {
48                        assert process instanceof ProcessWithPriority : "If priority boosts are used only ProcessWithPriorities can be used!";
49                        priority_boost.boost((ProcessWithPriority) process);
50                }
51        }
52 
53        protected void punish(IRunningProcess process) {
54                if (priority_boost != null) {
55                        assert process instanceof ProcessWithPriority : "If priority boosts are used only ProcessWithPriorities can be used!";
56                        priority_boost.punish((ProcessWithPriority) process);
57                }
58        }
59 
60        @Override
61        public String toString() {
62                return super.getName()+"_"+super.getId();
63        }
64}

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