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

COVERAGE SUMMARY FOR SOURCE FILE [DSEObjectives.java]

nameclass, %method, %block, %line, %
DSEObjectives.java0%   (0/1)0%   (0/16)0%   (0/218)0%   (0/42)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DSEObjectives0%   (0/1)0%   (0/16)0%   (0/218)0%   (0/42)
DSEObjectives (): void 0%   (0/1)0%   (0/18)0%   (0/4)
DSEObjectives (DominationStrategy): void 0%   (0/1)0%   (0/19)0%   (0/5)
addComputedAggregatedUsage (Criterion, ComputedAggregatedUsage): void 0%   (0/1)0%   (0/7)0%   (0/2)
addConfidence (Criterion, ConfidenceInterval): void 0%   (0/1)0%   (0/7)0%   (0/2)
addResult (Objective, IAnalysisResult): void 0%   (0/1)0%   (0/32)0%   (0/7)
addResultDecoratorFor (Criterion, ResultDecoratorRepository): void 0%   (0/1)0%   (0/7)0%   (0/2)
addValueForCriterion (Criterion, double): void 0%   (0/1)0%   (0/32)0%   (0/6)
get (Value): Objective 0%   (0/1)0%   (0/5)0%   (0/1)
getComputedAggregatedUsageFor (Criterion): ComputedAggregatedUsage 0%   (0/1)0%   (0/6)0%   (0/1)
getConfidenceIntervalForObjective (Criterion): ConfidenceInterval 0%   (0/1)0%   (0/6)0%   (0/1)
getConfidenceIntervalFromResult (IAnalysisResult): ConfidenceInterval 0%   (0/1)0%   (0/13)0%   (0/5)
getConfidenceIntervals (): Map 0%   (0/1)0%   (0/3)0%   (0/1)
getResultDecoratorFor (Criterion): ResultDecoratorRepository 0%   (0/1)0%   (0/6)0%   (0/1)
getValueForCriterion (Criterion): Value 0%   (0/1)0%   (0/29)0%   (0/5)
hasComputedAggregatedUsageFor (Criterion): boolean 0%   (0/1)0%   (0/14)0%   (0/1)
hasResultDecoratorFor (Criterion): boolean 0%   (0/1)0%   (0/14)0%   (0/1)

1package de.uka.ipd.sdq.dsexplore.opt4j.representation;
2 
3import java.util.HashMap;
4import java.util.Map;
5 
6import org.opt4j.core.Criterion;
7import org.opt4j.core.Objective;
8import org.opt4j.core.Constraint;
9import org.opt4j.core.Objectives;
10import org.opt4j.core.Value;
11import org.opt4j.core.domination.DominationStrategy;
12 
13import com.google.inject.Inject;
14 
15import de.uka.ipd.sdq.context.aggregatedUsageContext.ComputedAggregatedUsage;
16import de.uka.ipd.sdq.dsexplore.analysis.IAnalysisResult;
17import de.uka.ipd.sdq.dsexplore.analysis.IPerformanceAnalysisResult;
18import de.uka.ipd.sdq.dsexplore.analysis.IStatisticAnalysisResult;
19import de.uka.ipd.sdq.pcm.resultdecorator.ResultDecoratorRepository;
20import de.uka.ipd.sdq.statistics.estimation.ConfidenceInterval;
21 
22public class DSEObjectives extends Objectives {
23 
24        private Map<Criterion, ConfidenceInterval> confidence = new HashMap<Criterion, ConfidenceInterval>();
25        private Map<Criterion, ResultDecoratorRepository> resultDecorators = new HashMap<Criterion, ResultDecoratorRepository>();
26        private Map<Criterion, ComputedAggregatedUsage> computedAggregatedResult = new HashMap<Criterion, ComputedAggregatedUsage>();
27                
28        //private Map<Objective, IAnalysisResult> detailedResults = new TreeMap<Objective, IAnalysisResult>();
29        
30        public void addResult(Objective o, IAnalysisResult result){
31                //this.detailedResults.put(o, result);
32                ConfidenceInterval ci = this.getConfidenceIntervalFromResult(result);
33                if (ci != null){
34                        this.confidence.put(o, ci);
35                }
36                if (result instanceof IPerformanceAnalysisResult){
37                        this.resultDecorators.put(o, ((IPerformanceAnalysisResult) result).getResults());
38                        this.computedAggregatedResult .put(o, ((IPerformanceAnalysisResult) result).getComputedAggregatedUsage());
39                }
40        }
41        
42        @Deprecated
43        public DSEObjectives(){super();} // Get objects from provider 
44        
45        @Inject
46        public DSEObjectives(DominationStrategy strategy) {
47                super(strategy);
48        }
49        
50        
51        
52//        public boolean hasDetailedResultsForObjective(Objective o){
53//                return this.detailedResults.containsKey(o);
54//        }
55//        
56//        public IAnalysisResult getDetailedResultsFor(Objective o){
57//                return this.detailedResults.get(o);
58//        }
59 
60        @Override
61        public Objective get(Value<?> value) {
62                // TODO Auto-generated method stub
63                return super.get(value);
64        }
65        
66        public Value<?> getValueForCriterion(Criterion c){
67                if (c instanceof Objective){
68                        return this.get((Objective)c);
69                } else if (c instanceof Constraint){
70                        return this.getConstraints().get((Constraint)c);
71                } else {
72                        throw new RuntimeException("A criterion that is neither Objective nor Constraints has been encountered, contact developers. Class: "+c.getClass());
73                }
74        }
75 
76 
77 
78        public void addConfidence(Criterion o, ConfidenceInterval c){
79                this.confidence.put(o, c);
80        }
81        
82        /**
83         * 
84         * @return The Map of ConfidenceIntervals, which is not null, but may be empty. 
85         */
86        public Map<Criterion, ConfidenceInterval> getConfidenceIntervals(){
87                return this.confidence;
88        }
89        
90        /**
91         * Can be null
92         * @param o
93         * @return The confidence interval for the given Objective or null if it does not exist. 
94         */
95        public ConfidenceInterval getConfidenceIntervalForObjective(Criterion o){
96                return this.confidence.get(o);
97        }
98 
99        /**
100         * Can be null
101         * @param o
102         * @return The confidence interval for the given Objective or null if it does not exist. 
103         */
104        private ConfidenceInterval getConfidenceIntervalFromResult(
105                        IAnalysisResult result) {
106                if (result instanceof IStatisticAnalysisResult){
107                        IStatisticAnalysisResult statisticResult = (IStatisticAnalysisResult) result;
108                        ConfidenceInterval c = statisticResult.getConfidenceInterval();
109                        return c;
110                } else {
111                        return null;
112                }
113        }
114        
115        public void addResultDecoratorFor(Criterion performance, ResultDecoratorRepository resultDecorator){
116                this.resultDecorators.put(performance, resultDecorator);
117        }
118        
119 
120        /**
121         * May return null if no result decorator is available. 
122         * @param o
123         * @return
124         */
125        public ResultDecoratorRepository getResultDecoratorFor(
126                        Criterion o) {
127                return this.resultDecorators.get(o);
128        }
129        
130        /**
131         * Returns whether a non-null result decorator for this Objective o is available 
132         * @param o
133         * @return
134         */
135        public boolean hasResultDecoratorFor(
136                        Criterion o) {
137                return this.resultDecorators.containsKey(o) && this.resultDecorators.get(o) != null;
138        }
139        
140        public void addComputedAggregatedUsage(Criterion o, ComputedAggregatedUsage computedAggregatedUsage){
141                this.computedAggregatedResult.put(o, computedAggregatedUsage);
142        }
143        
144 
145        /**
146         * May return null if no result decorator is available. 
147         * @param o
148         * @return
149         */
150        public ComputedAggregatedUsage getComputedAggregatedUsageFor(Criterion o) {
151                return this.computedAggregatedResult.get(o);
152        }
153        
154        /**
155         * Returns whether a non-null result decorator for this Objective o is available 
156         * @param o
157         * @return
158         */
159        public boolean hasComputedAggregatedUsageFor(
160                        Criterion o) {
161                return this.computedAggregatedResult.containsKey(o) && this.computedAggregatedResult.get(o) != null;
162        }
163 
164        public void addValueForCriterion(Criterion criterion, double d) {
165                if (criterion instanceof Objective){
166                        this.add((Objective)criterion,d);
167                } else if (criterion instanceof Constraint){
168                        this.getConstraints().add((Constraint)criterion, d);
169                } else {
170                        throw new RuntimeException("A criterion that is neither Objective nor Constraints has been encountered, contact developers. Class: "+criterion.getClass());
171                }
172                
173        }
174        
175 
176}

[all classes][de.uka.ipd.sdq.dsexplore.opt4j.representation]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov