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

nameclass, %method, %block, %line, %
ElapsedTimeConfig.java0%   (0/2)0%   (0/10)0%   (0/105)0%   (0/20)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ElapsedTimeConfig0%   (0/1)0%   (0/6)0%   (0/55)0%   (0/18)
ElapsedTimeConfig (): void 0%   (0/1)0%   (0/4)0%   (0/2)
getExecutionInterval (): long 0%   (0/1)0%   (0/4)0%   (0/1)
getTimeType (): ElapsedTimeConfig$TimeType 0%   (0/1)0%   (0/3)0%   (0/1)
setExecutionInterval (long): void 0%   (0/1)0%   (0/14)0%   (0/4)
setTimeType (ElapsedTimeConfig$TimeType): void 0%   (0/1)0%   (0/11)0%   (0/4)
validateConfiguration (): boolean 0%   (0/1)0%   (0/19)0%   (0/6)
     
class ElapsedTimeConfig$TimeType0%   (0/1)0%   (0/4)0%   (0/50)0%   (0/2)
<static initializer> 0%   (0/1)0%   (0/24)0%   (0/1)
ElapsedTimeConfig$TimeType (String, int): void 0%   (0/1)0%   (0/5)0%   (0/1)
valueOf (String): ElapsedTimeConfig$TimeType 0%   (0/1)0%   (0/5)0%   (0/1)
values (): ElapsedTimeConfig$TimeType [] 0%   (0/1)0%   (0/16)0%   (0/1)

1/**
2 * 
3 */
4package de.uka.ipd.sdq.tcfmoop.config;
5 
6import de.uka.ipd.sdq.tcfmoop.config.exceptions.InvalidConfigException;
7 
8/**
9 * Configuration class for ElapsedTime termination criterion.
10 * @author Atanas Dimitrov
11 */
12public class ElapsedTimeConfig extends AbstractConfiguration {
13 
14        public enum TimeType{USER_TIME, CPU_TIME};
15        
16        //The minimum time the optimization is allowed to run
17        private Long executionInterval;
18        //The type of the time
19        private TimeType timeType;
20        
21        
22        public ElapsedTimeConfig(){
23                super(TerminationCriteriaNames.ELAPSED_TIME);
24        }
25        
26        /**
27         * {@inheritDoc}
28         */
29        @Override
30        public boolean validateConfiguration() {
31                if(this.getTerminationCriterionName() != TerminationCriteriaNames.ELAPSED_TIME ||
32                   this.executionInterval == null ||
33                   this.timeType != TimeType.CPU_TIME &&
34                   this.timeType != TimeType.USER_TIME){
35                        return false;
36                }else{
37                        return true;
38                }
39        }
40        
41        /**
42         * Sets the minimum time that the optimization is allowed to run.
43         * @param timeInMilis The minimum time in milliseconds that the optimization is allowed to run. Should be at least 1.
44         * @throws InvalidConfigException if the supplied parameter do not conform to the required conditions.
45         */
46        public void setExecutionInterval(long timeInMilis) throws InvalidConfigException{
47                if(timeInMilis < 1){
48                        throw new InvalidConfigException("ElapsedTimeConfig.setExecutionInterval: Negative Time is not allowed.");
49                }
50                this.executionInterval = timeInMilis;
51        }
52        
53        /**
54         * Returns the minimum time in milliseconds that the optimization is allowed to run.
55         * @return the minimum time in milliseconds that the optimization is allowed to run.
56         */
57        public long getExecutionInterval(){
58                return this.executionInterval;
59        }
60        
61        /**
62         * Sets the type of the time that is going to be measured: Pure-CPU time or Clock time. Please note that the 
63         * measurement of the SPU-Time might not always be possible. If this is the case, then the criterion will
64         * automatically switch to Clock time.
65         * @param timeType the type of the time to be measured.
66         * @throws InvalidConfigException if the supplied parameter do not conform to the required conditions.
67         */
68        public void setTimeType(TimeType timeType) throws InvalidConfigException{
69                if(timeType == null){
70                        throw new InvalidConfigException("ElapsedTimeConfig.setTimeType(): The supplied parameter should be TimeType.CPU_TIME or TimeType.USER_TIME." +
71                                        "Currently the parameter is null.");
72                }
73                this.timeType = timeType;
74        }
75        
76        /**
77         * Returns the type of the time that is going to be measured.
78         * @return the type of the time that is going to be measured.
79         */
80        public TimeType getTimeType(){
81                return this.timeType;
82        }
83 
84}

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