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

COVERAGE SUMMARY FOR SOURCE FILE [PreferIdealAndLastProcessSelector.java]

nameclass, %method, %block, %line, %
PreferIdealAndLastProcessSelector.java0%   (0/1)0%   (0/3)0%   (0/58)0%   (0/14)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PreferIdealAndLastProcessSelector0%   (0/1)0%   (0/3)0%   (0/58)0%   (0/14)
PreferIdealAndLastProcessSelector (): void 0%   (0/1)0%   (0/3)0%   (0/1)
isPreferred (IActiveProcess, IResourceInstance): boolean 0%   (0/1)0%   (0/12)0%   (0/2)
select (IRunQueue, IResourceInstance): IActiveProcess 0%   (0/1)0%   (0/43)0%   (0/11)

1package de.uka.ipd.sdq.scheduler.loaddistribution.selectors.process;
2 
3import de.uka.ipd.sdq.scheduler.loaddistribution.IProcessSelector;
4import de.uka.ipd.sdq.scheduler.processes.IActiveProcess;
5import de.uka.ipd.sdq.scheduler.queueing.IProcessQueue;
6import de.uka.ipd.sdq.scheduler.queueing.IRunQueue;
7import de.uka.ipd.sdq.scheduler.resources.IResourceInstance;
8 
9public class PreferIdealAndLastProcessSelector implements IProcessSelector {
10 
11        public IActiveProcess select(IRunQueue runQueue, IResourceInstance instance) {
12                IProcessQueue queue = runQueue.getBestRunnableQueue(instance);
13                IActiveProcess result = null;
14                if (queue != null) {
15                        for (IActiveProcess process : queue.ascending()) {
16                                if (process.checkAffinity(instance)) {
17                                        if (result == null) {
18                                                result = process;
19                                        } else if (isPreferred(process, instance)
20                                                        && !isPreferred(result, instance)) {
21                                                return process;
22                                        }
23                                }
24                        }
25                }
26                return result;
27        }
28 
29        private boolean isPreferred(IActiveProcess process,
30                        IResourceInstance instance) {
31                return process.isIdealInstance(instance)
32                                || process.isLastInstance(instance);
33        }
34}

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