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

COVERAGE SUMMARY FOR SOURCE FILE [InsignificantSetQualityImprovementConfig.java]

nameclass, %method, %block, %line, %
InsignificantSetQualityImprovementConfig.java0%   (0/3)0%   (0/10)0%   (0/124)0%   (0/34)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class InsignificantSetQualityImprovementConfig0%   (0/1)0%   (0/8)0%   (0/63)0%   (0/20)
InsignificantSetQualityImprovementConfig (): void 0%   (0/1)0%   (0/4)0%   (0/2)
getComparisionGenerations (): int 0%   (0/1)0%   (0/4)0%   (0/1)
getUnresolvedValueDifferences (): List 0%   (0/1)0%   (0/3)0%   (0/1)
getValueDifferences (): List 0%   (0/1)0%   (0/3)0%   (0/1)
setComparisionGenerations (int): void 0%   (0/1)0%   (0/13)0%   (0/4)
setUnresolvedValueDifferences (List): void 0%   (0/1)0%   (0/4)0%   (0/2)
setValueDifferences (List): void 0%   (0/1)0%   (0/14)0%   (0/4)
validateConfiguration (): boolean 0%   (0/1)0%   (0/18)0%   (0/5)
     
class InsignificantSetQualityImprovementConfig$UnresolvedValueDifference0%   (0/1)0%   (0/1)0%   (0/15)0%   (0/5)
InsignificantSetQualityImprovementConfig$UnresolvedValueDifference (Insignifi... 0%   (0/1)0%   (0/15)0%   (0/5)
     
class InsignificantSetQualityImprovementConfig$ValueDifference0%   (0/1)0%   (0/1)0%   (0/46)0%   (0/9)
InsignificantSetQualityImprovementConfig$ValueDifference (InsignificantSetQua... 0%   (0/1)0%   (0/46)0%   (0/9)

1/**
2 * 
3 */
4package de.uka.ipd.sdq.tcfmoop.config;
5 
6import java.util.List;
7 
8import org.opt4j.core.Objective;
9 
10import de.uka.ipd.sdq.tcfmoop.config.exceptions.InvalidConfigException;
11 
12/**
13 * Configuration class for InsignificantSetQualityImprovement termination criterion.
14 * @author Atanas Dimitrov
15 */
16public class InsignificantSetQualityImprovementConfig extends
17                AbstractConfiguration {
18        
19        //Contains information about an objective, its allowed average Improvement and maxMin Improvement
20        private List<ValueDifference> valueDifferences;
21        //Contains information about an objective (in String Representation), its allowed average Improvement and maxMin Improvement
22        //The state of this attribute does not interfere with the state of the configuration object at all.
23        private List<UnresolvedValueDifference> unresolvedValueDifferences;
24        //the n-x. set to compare with
25        private Integer pastIterationNumber;
26 
27 
28        public InsignificantSetQualityImprovementConfig(){
29                super(TerminationCriteriaNames.INSIGNIFICANT_SET_QUALITY_IMPROVEMENT);
30        }
31 
32        /**
33         * {@inheritDoc}
34         */
35        @Override
36        public boolean validateConfiguration() {
37                if (this.getTerminationCriterionName() != TerminationCriteriaNames.INSIGNIFICANT_SET_QUALITY_IMPROVEMENT ||
38                                this.valueDifferences == null || this.valueDifferences.isEmpty() ||
39                                this.pastIterationNumber == null){
40                        return false;
41                } else {
42                        return true;
43                }
44        }
45        
46        /**
47         * Set the list ValueObjects(objective name, allowed averages, wallower maxMin).
48         * @param valueDifferences (objective name, allowed averages, wallower maxMin)
49         * @throws InvalidConfigException if the supplied parameter do not conform to the required conditions.
50         */
51        public void setValueDifferences(List<ValueDifference> valueDifferences) throws InvalidConfigException{
52                if(valueDifferences == null || valueDifferences.isEmpty()){
53                        throw new InvalidConfigException("InsignificantSetQualityImprovementConfig.setMaximumValueDifferences: " +
54                                        "the supplied parameter should not be null or empty");
55                }
56                
57                this.valueDifferences = valueDifferences;
58        }
59        
60        /**
61         * Return a List of ValueObjects witch contain the allowed average and maxMin improvement for a specific
62         * Objective.
63         * @return List of ValueObjects witch contains the allowed average and maxMin improvement for a specific
64         * Objective
65         */
66        public List<ValueDifference> getValueDifferences(){
67                return this.valueDifferences;
68        }
69        
70        /**
71         * Configures the average and the MaxMin improvement values for the objectives without resolving it.
72         * The String keys of the objectives are used instead. The List can later be read 
73         * for fully resolving the objectives. This must be done, before the configuration object is
74         * supplied to the TerminationCriteriaManager. The TerminationCriterion cannot work with
75         * unresolved Objectives and therefore the validation of the Configuration object is not
76         * influenced by this parameter at all.
77         * @param unresolvedValueDifferences
78         */
79        public void setUnresolvedValueDifferences(List<UnresolvedValueDifference> unresolvedValueDifferences){
80                this.unresolvedValueDifferences = unresolvedValueDifferences;
81        }
82        
83        /**
84         * Returns a List of UnresolvedValueDifferences (Objective String, Average improvement, MaxMin improvement).
85         * The String is the key that can be used to resolve the object.
86         * The List must be previously set or it will be empty.
87         * @return
88         */
89        public List<UnresolvedValueDifference> getUnresolvedValueDifferences(){
90                return this.unresolvedValueDifferences;
91        }
92        
93        /**
94         * Sets the number for the x. past iteration to compare the current set with.
95         * @param pastIterationNumber the number for the x. past set to compare the current one with.
96         * @throws InvalidConfigException if the supplied parameter do not conform to the required conditions.
97         */
98        public void setComparisionGenerations(int pastIterationNumber) throws InvalidConfigException{
99                if(pastIterationNumber < 1){
100                        throw new InvalidConfigException("InsignificantSetQualityImprovementConfig.setComparisionGenerations: " +
101                                        "The parameter indicates how many generations in the past the current value is going to be compared with and " +
102                                        " must be at least 1.");
103                }else{
104                        this.pastIterationNumber = pastIterationNumber;
105                }
106        }
107        
108        /**
109         * Get the number for the x. past set to compare the current one with.
110         * @return the number for the x. past set to compare the current one with.
111         */
112        public int getComparisionGenerations(){
113                return this.pastIterationNumber;
114        }
115        
116        public class ValueDifference{
117                public final Objective objective;
118                public final Double averageImprovement;
119                public final Double maxMinImprovement;
120                
121                /**
122                 * A helper Class to bind objectiveName to a specific ObjectiveSign and ObjectiveMinimalValue
123                 * @param objective should not be null
124                 * @param maxMinImprovement should not be null
125                 * @param averageImprovement should not be null
126                 * @throws Exception if parameter(s) are null
127                 */
128                public ValueDifference(Objective objective, Double averageImprovement, Double maxMinImprovement) throws InvalidConfigException{
129                        if(averageImprovement == null || objective == null || maxMinImprovement == null || 
130                                        averageImprovement < 0 || averageImprovement > 1 ||
131                                        maxMinImprovement < 0 || maxMinImprovement > 1){
132                                throw new InvalidConfigException("ValueDifference.ValueDifference: " +
133                                                "None of the supplied parameters should be null and averageImprovement and maxMinimprovement must be a percentage values between 0 and 1");
134                        }
135                        this.objective = objective;
136                        this.averageImprovement = averageImprovement;
137                        this.maxMinImprovement = maxMinImprovement;
138                }
139        }
140        
141        public class UnresolvedValueDifference{
142                public final String objective;
143                public final Double averageImprovement;
144                public final Double maxMinImprovement;
145                
146                /**
147                 * A helper Class to bind objectiveName (in String representation) to a specific ObjectiveSign and ObjectiveMinimalValue
148                 * The objectives must later be resolved, because the Termination Criterion can only work with resolved Objectives.
149                 * @param objective should not be null
150                 * @param maxMinImprovement should not be null
151                 * @param averageImprovement should not be null
152                 * @throws Exception if parameter(s) are null
153                 */
154                public UnresolvedValueDifference(String objective, Double averageImprovement, Double maxMinImprovement) throws Exception{
155                        this.objective = objective;
156                        this.averageImprovement = averageImprovement;
157                        this.maxMinImprovement = maxMinImprovement;
158                }
159        }
160 
161}

[all classes][de.uka.ipd.sdq.tcfmoop.config]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov