Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
epoxy
GitHub Repository: epoxy/proj11
Path: blob/master/SLICK_HOME/src/org/newdawn/slick/command/BasicCommand.java
1456 views
1
package org.newdawn.slick.command;
2
3
/**
4
* A simple named command
5
*
6
* @author kevin
7
*/
8
public class BasicCommand implements Command {
9
/** The name of the command */
10
private String name;
11
12
/**
13
* Create a new basic command
14
*
15
* @param name The name to give this command
16
*/
17
public BasicCommand(String name) {
18
this.name = name;
19
}
20
21
/**
22
* Get the name given for this basic command
23
*
24
* @return The name given for this basic command
25
*/
26
public String getName() {
27
return name;
28
}
29
30
/**
31
* @see java.lang.Object#hashCode()
32
*/
33
public int hashCode() {
34
return name.hashCode();
35
}
36
37
/**
38
* @see java.lang.Object#equals(java.lang.Object)
39
*/
40
public boolean equals(Object other) {
41
if (other instanceof BasicCommand) {
42
return ((BasicCommand) other).name.equals(name);
43
}
44
45
return false;
46
}
47
48
/**
49
* @see java.lang.Object#toString()
50
*/
51
public String toString() {
52
return "[Command="+name+"]";
53
}
54
}
55
56