summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/model/PlayerSettings.java
blob: 217b1fc5fc02f5c5f7766af806bf6bfd0a29b12a (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
package jrummikub.model;

import java.awt.Color;

import jrummikub.control.turn.HumanTurnControl;
import jrummikub.control.turn.TurnControlFactory;

/**
 * The settings of a player
 */
public class PlayerSettings {
	private String name;
	private Color color;
	private TurnControlFactory turnControlFactory;

	/**
	 * Create a new player
	 * 
	 * @param name
	 *            the player's name
	 * @param color
	 *            the player's color
	 * @param turnControlFactory
	 *            the player's {@link TurnControlFactory}
	 */
	public PlayerSettings(String name, Color color,
			TurnControlFactory turnControlFactory) {
		this.name = name;
		this.color = color;
		this.turnControlFactory = turnControlFactory;
	}
	
	/**
	 * Create a new human player
	 * 
	 * @param name
	 *            the player's name
	 * @param color
	 *            the player's color
	 */
	public PlayerSettings(String name, Color color) {
		this.name = name;
		this.color = color;
		this.turnControlFactory = HumanTurnControl.getFactory();
	}

	/**
	 * Returns the player's color
	 * 
	 * @return the color
	 */
	public Color getColor() {
		return color;
	}

	/**
	 * Returns the player's name
	 * 
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * Sets the player's color
	 * 
	 * @param color
	 *            the new color
	 */
	public void setColor(Color color) {
		this.color = color;
	}

	/**
	 * Sets the player's name
	 * 
	 * @param name
	 *            the new name
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * Set the player's TurnControlFactory
	 * 
	 * @param turnControlFactory
	 *            player's TurnControlFactory
	 */
	public void setTurnControlFactory(TurnControlFactory turnControlFactory) {
		this.turnControlFactory = turnControlFactory;
	}

	/**
	 * Get the player's TurnControlFactory
	 * 
	 * @return player's TurnControlFactory
	 */
	public TurnControlFactory getTurnControlFactory() {
		return turnControlFactory;
	}
}