Back to project page MentalMathX.
The source code is released under:
GNU General Public License
If you think the Android project MentalMathX listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package net.schlingel.bplaced.mentalmathx.game.strategy; /*from w w w.j a va 2 s . c o m*/ import net.schlingel.bplaced.mentalmathx.game.Difficulty; /** * Created by zombie on 29.06.14. */ public class ExerciseStrategyFactory { public static ExerciseStrategy getInstance(Difficulty difficulty) { if(difficulty == null) { throw new IllegalArgumentException("Difficulty must not be null!"); } ExerciseStrategy strategy = null; switch (difficulty) { case VeryEasy: strategy = new OneOOneExerciseStrategy(); break; case Easy: strategy = new EasyExerciseStrategy(); break; case Medium: strategy = new MediumExerciseStrategy(); break; case Hard: strategy = new HardExerciseStrategy(); break; default: throw new IllegalStateException("Got difficulty instace which was neither Easy, Medium nor Hard!"); } return strategy; } }