source: xssim/trunk/src/schedframe/scheduling/AbstractResourceRequirements.java @ 104

Revision 104, 1.8 KB checked in by wojtekp, 13 years ago (diff)
  • Property svn:mime-type set to text/plain
Line 
1package schedframe.scheduling;
2
3import schedframe.scheduling.utils.DescriptionContainer;
4import schedframe.scheduling.utils.ResourceParameterName;
5
6/**
7 *
8 * @author Marcin Krystek
9 *
10 * @param <T>
11 */
12public abstract class AbstractResourceRequirements<T> implements DescriptionContainer<T> {
13
14        protected T resourceRequirements;
15        protected boolean isBestEffort;
16       
17       
18        protected AbstractResourceRequirements(){
19                this.isBestEffort = true;
20        }
21        /**
22         *
23         * @param parameterName name of the task resource requirement
24         * @return value of the numeral parameter which describes task resource requirement
25         * @throws NoSuchFieldException if such parameter is not defined
26         * @throws IllegalArgumentException if requested parameter is String value
27         */
28        public abstract double getParameterDoubleValue(ResourceParameterName parameterName)
29                throws NoSuchFieldException, IllegalArgumentException;
30       
31        /**
32         *
33         * @param parameterName name of the task resource requirement
34         * @return value of the String parameter which describes task resource requirement
35         * @throws NoSuchFieldException if such parameter is not defined
36         * @throws IllegalArgumentException if requested parameter is Double value
37         */
38        public abstract String getParameterStringValue(ResourceParameterName parameterName)
39                throws NoSuchFieldException, IllegalArgumentException;
40       
41       
42        public double getCpuCntRequest() throws NoSuchFieldException{
43                return getParameterDoubleValue(ResourceParameterName.CPUCOUNT);
44        }
45       
46        public double getMemoryRequest() throws NoSuchFieldException{
47                return getParameterDoubleValue(ResourceParameterName.MEMORY);
48        }
49       
50        public int getProcessesCount(){
51                return 1;
52        }
53       
54        public boolean isBestEffort(){
55                return this.isBestEffort;
56        }
57       
58        public void setBestEffort(boolean value){
59                this.isBestEffort = value;
60        }
61       
62}
Note: See TracBrowser for help on using the repository browser.