summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/control/turn/TurnControlFactory.java
blob: 44747631cdc850f8b8b5074a09db3f2bbdd4476a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package jrummikub.control.turn;

/**
 * Creates a turn control for the active player, regarding if layer is human or
 * computer
 * 
 */
public abstract class TurnControlFactory {
	/**
	 * Type of turn control.
	 */
	public enum Type {
		/** */
		HUMAN,
		/** */
		COMPUTER
	};

	
	public abstract ITurnControl create();

	/**
	 * returns the turn control factory for the specified type
	 * 
	 * @param type
	 *            Human or Computer
	 * @return TurnControlFactory for the player kind
	 */
	static public TurnControlFactory getFactory(Type type) {
		switch (type) {
		case HUMAN:
			return HumanTurnControl.getFactory();
		case COMPUTER:
			return BaseAIControl.getFactory();
		}
		return null;
	}
}