package test.rewolucja.energy.profile; import test.rewolucja.energy.profile.implementation.CPUPowerProfile; import test.rewolucja.energy.profile.implementation.CPU_A_PowerProfile; import test.rewolucja.energy.profile.implementation.CPU_B_PowerProfile; import test.rewolucja.energy.profile.implementation.CPU_C_PowerProfile; import test.rewolucja.resources.Category; public class CPUPowerProfileFactory { public static CPUPowerProfile createCPUPowerProfile(Category cat) { if(cat.getName().equals("A")){ return new CPU_A_PowerProfile(); } else if (cat.getName().equals("B")){ return new CPU_B_PowerProfile(); } else if (cat.getName().equals("C")){ return new CPU_C_PowerProfile(); } else throw new IllegalArgumentException("The CPU Model " + cat.getName() + " is not recognized."); } }