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

COVERAGE SUMMARY FOR SOURCE FILE [PriorityImpl.java]

nameclass, %method, %block, %line, %
PriorityImpl.java0%   (0/1)0%   (0/16)0%   (0/193)0%   (0/32)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PriorityImpl0%   (0/1)0%   (0/16)0%   (0/193)0%   (0/32)
PriorityImpl (int, PriorityManagerImpl): void 0%   (0/1)0%   (0/9)0%   (0/4)
absoluteValue (): int 0%   (0/1)0%   (0/3)0%   (0/1)
addBonus (int): IPriority 0%   (0/1)0%   (0/47)0%   (0/8)
clone (): IPriority 0%   (0/1)0%   (0/8)0%   (0/1)
decrease (): IPriority 0%   (0/1)0%   (0/12)0%   (0/1)
distance (IPriority): int 0%   (0/1)0%   (0/7)0%   (0/1)
equals (Object): boolean 0%   (0/1)0%   (0/17)0%   (0/4)
getManager (): IPriorityManager 0%   (0/1)0%   (0/3)0%   (0/1)
getValue (): int 0%   (0/1)0%   (0/3)0%   (0/1)
greaterThan (IPriority): boolean 0%   (0/1)0%   (0/22)0%   (0/1)
hashCode (): int 0%   (0/1)0%   (0/3)0%   (0/1)
increase (): IPriority 0%   (0/1)0%   (0/12)0%   (0/1)
lessOrEqual (IPriority): boolean 0%   (0/1)0%   (0/22)0%   (0/1)
setTo (IPriority): void 0%   (0/1)0%   (0/5)0%   (0/2)
setValue (int): void 0%   (0/1)0%   (0/12)0%   (0/3)
toString (): String 0%   (0/1)0%   (0/8)0%   (0/1)

1package de.uka.ipd.sdq.scheduler.priority.impl;
2 
3import de.uka.ipd.sdq.scheduler.priority.IPriority;
4import de.uka.ipd.sdq.scheduler.priority.IPriorityManager;
5 
6public class PriorityImpl implements IPriority {
7        
8        protected PriorityManagerImpl manager;
9        protected int value;
10        protected int absolute_value;
11        
12 
13        protected PriorityImpl(int value, PriorityManagerImpl manager) {
14                this.manager = manager;
15                this.setValue(value);
16        }
17        
18 
19        
20        public int absoluteValue() {
21                return absolute_value;
22        }
23 
24        
25        public IPriorityManager getManager() {
26                return manager;
27        }
28 
29        
30        public boolean greaterThan(IPriority prio) {
31                return manager.direction > 0 ? this.getValue() > prio.getValue() : this.getValue() < prio.getValue();
32        }
33 
34        
35        public boolean lessOrEqual(IPriority prio) {
36                return manager.direction > 0 ? this.getValue() <= prio.getValue() : this.getValue() >= prio.getValue();
37        }
38 
39        
40        public IPriority increase() {
41                return new PriorityImpl(value + manager.direction, manager);
42        }
43        
44        
45        public IPriority decrease() {
46                return new PriorityImpl(value - manager.direction, manager);        }
47 
48 
49        
50        public int distance(IPriority prio) {
51                return Math.abs(this.getValue() - prio.getValue());
52        }
53        
54        
55        public int getValue() {
56                return value;
57        }
58        
59        
60        public void setValue(int value) {
61                this.value = value;
62                this.absolute_value = Math.abs(value - manager.lowest_value);
63        }
64 
65        
66        public void setTo(IPriority priority) {
67                this.setValue(priority.getValue());
68        }
69 
70        
71        public IPriority addBonus(int bonus) {
72                bonus *= manager.direction;
73                int new_value = this.getValue() + bonus;
74                if (manager.direction > 0){
75                        new_value = Math.max(new_value, manager.lowest_value);
76                        new_value = Math.min(new_value, manager.highest_value);
77                } else {
78                        new_value = Math.min(new_value, manager.lowest_value);
79                        new_value = Math.max(new_value, manager.highest_value);
80                }
81                return new PriorityImpl(new_value,manager);
82        }
83 
84        @Override        
85        public int hashCode() {
86                return absolute_value;
87        }
88        
89        @Override        
90        public boolean equals(Object obj) {
91                if (obj instanceof PriorityImpl) {
92                        PriorityImpl prio = (PriorityImpl) obj;
93                        return prio.value == this.value;
94                }
95                return false;
96        }
97        
98        @Override        
99        public IPriority clone() {
100                return new PriorityImpl(this.value,this.manager);
101        }
102        
103        @Override
104        public String toString() {
105                return ""+value;
106        }
107}

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