source: DCWoRMS/trunk/src/schedframe/resources/units/GPU.java @ 477

Revision 477, 1.0 KB checked in by wojtekp, 13 years ago (diff)
  • Property svn:mime-type set to text/plain
Line 
1package schedframe.resources.units;
2
3
4
5public class GPU extends AbstractResourceUnit {
6
7        protected int total;
8        protected int used;
9
10        public GPU(GPU m) {
11                super(m);
12                this.total = m.total;
13                this.used = m.used;
14        }
15       
16        public GPU(int total, int used) {
17                super(StandardResourceUnitName.GPU);
18                this.total = total;
19                this.used = used;
20        }
21       
22        public GPU(String resId, int total, int used) {
23                super(StandardResourceUnitName.GPU, resId);
24                this.total = total;
25                this.used = used;
26        }
27
28        public int getFreeAmount() {
29                return this.total - this.used;
30        }
31
32        public int getUsedAmount(){
33                return this.used;
34        }
35       
36        public void setUsedAmount(int amount){
37                if(amount > this.total){
38                        throw new IllegalArgumentException(
39                                        "Used amount can not be grather then total amount.");
40                }
41                this.used = amount;
42        }
43       
44        public int getAmount(){
45                return this.total;
46        }
47
48        @Override
49        public ResourceUnit toDiscrete() throws ClassNotFoundException {
50                // TODO Auto-generated method stub
51                return null;
52        }
53
54        public int compareTo(ResourceUnit o) {
55                // TODO Auto-generated method stub
56                return 0;
57        }
58
59}
Note: See TracBrowser for help on using the repository browser.