Revision 104,
1.1 KB
checked in by wojtekp, 13 years ago
(diff) |
|
-
Property svn:mime-type set to
text/plain
|
Rev | Line | |
---|
[104] | 1 | package schedframe.resources.units; |
---|
| 2 | |
---|
| 3 | import schedframe.scheduling.utils.ResourceParameterName; |
---|
| 4 | |
---|
| 5 | public class GPU extends ResourceUnit { |
---|
| 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(ResourceParameterName.GPUCOUNT); |
---|
| 18 | this.total = total; |
---|
| 19 | this.used = used; |
---|
| 20 | } |
---|
| 21 | |
---|
| 22 | public GPU(String resId, int total, int used) { |
---|
| 23 | super(resId, ResourceParameterName.GPUCOUNT); |
---|
| 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.