-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommandWord.java
More file actions
62 lines (53 loc) · 1.41 KB
/
CommandWord.java
File metadata and controls
62 lines (53 loc) · 1.41 KB
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
import java.util.HashMap;
/**
* mot-commandes autorises
* @author Clément Chomicki
*/
public enum CommandWord
{
UNKNOWN("?"),
GO("go", "aller"),
QUIT("quit", "aurevoir"),
HELP("help", "aled"),
LOOK("look"),
EAT("eat"),
BACK("back"),
TEST("test"),
TAKE("take"),
DROP("drop"),
STONE("stone"),
ALEA("alea"),
ITEMS("items");
private HashMap<Language, String> aWords;
/**
* Constructeur de l'enum
* @param pWord la chaîne correspondant au mot-commande dans toutes les langues
*/
CommandWord(final String pWord)
{
this.aWords = new HashMap<Language, String>();
for (Language vLang : Language.values())
this.aWords.put(vLang, pWord);
}
/**
* Constructeur de l'enum
* @param pWordEn la chaîne correspondant au mot-commande en anglais
* @param pWordFr la chaîne correspondant au mot-commande en francais
*/
CommandWord(final String pWordEn,
final String pWordFr )
{
this.aWords = new HashMap<Language, String>();
this.aWords.put(Language.ENGLISH, pWordEn);
this.aWords.put(Language.FRENCH , pWordFr);
}
/**
* Retourne une des traductions du mot-commande
* @param pLang langage voulu
* @return la chaine de caractere correspondant au mot-commande dans la langue pLang
*/
public String toString(final Language pLang)
{
return this.aWords.get(pLang);
}
}