-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommand.java
53 lines (50 loc) · 1.5 KB
/
Command.java
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
/**
* classe Command qui detecte une action clavier et effectue une action jeux
* @author Aubert Antoine
* @version 08/05/21
*/
public class Command
{
private String aCommandWord; //commande 1er mot
private String aSecondWord; //commande 2eme mot
/**
* Constructeur naturel qui attribue les valeurs de aCommandWord et de aSecondWorld
* @param pCommandWord es le 1er mot de cmd
* @param pSecondWord est le second mot
*/
public Command(final String pCommandWord, final String pSecondWord)
{
this.aCommandWord = pCommandWord;
this.aSecondWord = pSecondWord;
}//Command(..)
/**
* getter de CommandWord()
* @return this.aCommandWord
*/
public String getCommandWord() {return this.aCommandWord;}
/**
* getter de secondWord()
* @return this.aSecondWord
*/
public String getSecondWord() {return this.aSecondWord;}
/**
* fonction booleenne qui atteste la presence d un 2eme mot (SecondWord)
* @return true/false en fonction de si SecondWord == null
*/
public boolean hasSecondWord()
{
return this.aSecondWord != null;
}//hasSecondWord()
/**
* fonction booleenne qui atteste la presence d un 1eme mot
* @return true/false en fonction de si aCommandWord == null
*/
public boolean isUnknown()
{
if(this.aCommandWord == null){
return true;
}else{
return false;
}
}//isUnknown()
} // Command