-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMazeEntry.java
47 lines (46 loc) · 946 Bytes
/
MazeEntry.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
/**
* Enum class to define the characters in maze
* @author Saroj Tripathi
*
*/
public enum MazeEntry {
WALL, PATH, ENTRY, EXIT, SOLUTION;
/**
* Static function to set a enum to a character
* @param a Character to set
* @return Corresponding Enum if found else null
*/
public static MazeEntry zuweisen(char a) {
switch(a) {
case '#':
return MazeEntry.WALL;
case ' ':
return MazeEntry.PATH;
case 'e':
return MazeEntry.ENTRY;
case 'E':
return MazeEntry.EXIT;
default:
return null;
}
}
/**
* Static Method to return corresponding character in maze for the enum type
* @param a MazeEntry enum type to define a character in maze
* @return Character in the position
*/
public static char getchar(MazeEntry a) {
switch(a) {
case WALL:
return '#';
case ENTRY:
return 'e';
case EXIT:
return 'E';
case SOLUTION:
return 'S';
default:
return ' ';
}
}
}