Revision 104,
657 bytes
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 | /** |
---|
| 6 | * |
---|
| 7 | * @author Marcin Krystek |
---|
| 8 | * |
---|
| 9 | */ |
---|
| 10 | public class ResourceUnitFactory { |
---|
| 11 | |
---|
| 12 | public static ResourceUnit creteUnit(ResourceParameterName name, int totalAmount, int usedAmount){ |
---|
| 13 | |
---|
| 14 | switch(name){ |
---|
| 15 | case CPUCOUNT: return new Processors(totalAmount, usedAmount, 1); |
---|
| 16 | case MEMORY: return new Memory(totalAmount, usedAmount); |
---|
| 17 | case FREEMEMORY: return new FreeMemory(totalAmount, usedAmount); |
---|
| 18 | case CPUSPEED: return new CpuSpeed(totalAmount, usedAmount); |
---|
| 19 | default: |
---|
| 20 | throw new IllegalArgumentException("Paramter " + name + " is not supported."); |
---|
| 21 | } |
---|
| 22 | } |
---|
| 23 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.