source: xssim/src/schedframe/resources/units/ResourceUnitFactory.java @ 104

Revision 104, 657 bytes checked in by wojtekp, 13 years ago (diff)
  • Property svn:mime-type set to text/plain
Line 
1package schedframe.resources.units;
2
3import schedframe.scheduling.utils.ResourceParameterName;
4
5/**
6 *
7 * @author Marcin Krystek
8 *
9 */
10public 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.