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 [MinimalQualityCriteriaValueConfig.java]

nameclass, %method, %block, %line, %
MinimalQualityCriteriaValueConfig.java0%   (0/1)0%   (0/8)0%   (0/75)0%   (0/22)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class MinimalQualityCriteriaValueConfig0%   (0/1)0%   (0/8)0%   (0/75)0%   (0/22)
MinimalQualityCriteriaValueConfig (): void 0%   (0/1)0%   (0/14)0%   (0/4)
getNumberOfCandidatesToConform (): int 0%   (0/1)0%   (0/4)0%   (0/1)
getObjectiveMinimalValues (): Map 0%   (0/1)0%   (0/3)0%   (0/1)
getUnresolvedObjectiveMinimalValue (): Map 0%   (0/1)0%   (0/3)0%   (0/1)
setNumberOfCandidatesToConform (int): void 0%   (0/1)0%   (0/13)0%   (0/4)
setObjectiveMinimalValues (Map): void 0%   (0/1)0%   (0/15)0%   (0/4)
setUnresolvedObjectiveMinimalValue (Map): void 0%   (0/1)0%   (0/5)0%   (0/2)
validateConfiguration (): boolean 0%   (0/1)0%   (0/18)0%   (0/5)

1package de.uka.ipd.sdq.tcfmoop.config;
2 
3import java.util.HashMap;
4import java.util.Map;
5 
6import org.opt4j.core.Objective;
7import org.opt4j.core.Value;
8 
9import de.uka.ipd.sdq.tcfmoop.config.exceptions.InvalidConfigException;
10 
11/**
12 * Configuration class for MinimalQualityCriteriaValue termination criterion.
13 * @author Atanas Dimitrov
14 */
15public class MinimalQualityCriteriaValueConfig extends AbstractConfiguration {
16        
17        //Unresolved Objectives and Values. Objectives are still String keys
18        private Map<String, Value<?>> unresolvedObjectives = new HashMap<String, Value<?>>();        
19        //Already configured Objectives with their minimum required values.
20        private Map<Objective, Value<?>> configuredObjectives = new HashMap<Objective, Value<?>>();
21        //The required minimal number of parameters that need to have greater quality criteria values then the minimum values. 
22        private Integer numberOfCandidatesToConform;
23        
24        public MinimalQualityCriteriaValueConfig(){
25                super(TerminationCriteriaNames.MINIMAL_QUALITY_CIRTERIA_VALUE);
26        }
27        
28        /**
29         * {@inheritDoc}
30         */
31        @Override
32        public boolean validateConfiguration() {
33                if (this.getTerminationCriterionName() != TerminationCriteriaNames.MINIMAL_QUALITY_CIRTERIA_VALUE ||
34                                this.configuredObjectives == null || this.configuredObjectives.isEmpty() ||
35                                this.numberOfCandidatesToConform == null){
36                        return false;
37                } else {
38                        return true;
39                }
40        }
41        
42        /**
43         * Set the List of objective minimum values.
44         * @param objectiveDescriptions a Map of objective minimum values. The List should not be null or empty.
45         * The Map will not be copied by reference. But its Elements will.
46         * @throws InvalidConfigException if the supplied parameter do not conform to the required conditions.
47         */
48        public void setObjectiveMinimalValues(Map<Objective, Value<?>> configuredObjectives) throws InvalidConfigException{
49                if(configuredObjectives == null || configuredObjectives.isEmpty()){
50                        throw new InvalidConfigException("MinimalQualityCriteriaValueConfig.setObjectiveMinimalValue: " +
51                                        "the supplied parameter should not be null or empty");
52                }
53                
54                this.configuredObjectives.putAll(configuredObjectives);
55        }
56        
57        /**
58         * Returns the List the configured Minimal Values for some or for all objectives of the optimization.
59         * @return the List the configured Minimal Values for some or for all objectives of the optimization.
60         */
61        public Map<Objective, Value<?>> getObjectiveMinimalValues(){
62                return this.configuredObjectives;
63        }
64        
65        /**
66         * Configures the minimal values for the objectives without resolving them.
67         * The String keys of the objectives are used instead. The map can be later read 
68         * for fully resolving the objectives. This must be done, before the configuration object is
69         * supplied to the TerminationCriteriaManager. The TerminationCriterion cannot work with
70         * unresolved Objectives and therefore the validation of the Configuration object is not
71         * influenced by this parameter at all.
72         * @param unresolvedObjectives
73         */
74        public void setUnresolvedObjectiveMinimalValue(Map<String, Value<?>> unresolvedObjectives){
75                this.unresolvedObjectives.putAll(unresolvedObjectives);
76        }
77        
78        /**
79         * Returns a map of String - Value<?> items. The String is the key that can be used to
80         * resolve the object. The Map must be previously set or it will be empty.
81         * @return map of String, Value pairs.
82         */
83        public Map<String, Value<?>> getUnresolvedObjectiveMinimalValue(){
84                return this.unresolvedObjectives;
85        }
86        
87        /**
88         * Set the number of candidates that must have quality criteria values greater then the supplied minimum.
89         * @param numberOfCandidates the number of candidates that must have quality criteria values greater then the supplied minimum. Must be >=1.
90         * @throws InvalidConfigException if the supplied parameter do not conform to the required conditions.
91         */
92        public void setNumberOfCandidatesToConform(int numberOfCandidates) throws InvalidConfigException{
93                if(numberOfCandidates < 1){
94                        throw new InvalidConfigException("MinimalQualityCriteriaValueConfig.setNumberOfCandidatesToConform: " +
95                        "the provided number of candidates to conform to the conditions must be at least 1");
96                }
97                
98                this.numberOfCandidatesToConform = numberOfCandidates;
99        }
100        
101        /**
102         * Get the number of candidates that must have quality criteria values greater then the supplied minimum.
103         * @return the number of candidates that must have quality criteria values greater then the supplied minimum.
104         */
105        public int getNumberOfCandidatesToConform(){
106                return this.numberOfCandidatesToConform;
107        }
108}

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