-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpaceType.java
More file actions
39 lines (36 loc) · 1.08 KB
/
SpaceType.java
File metadata and controls
39 lines (36 loc) · 1.08 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
import java.awt.*;
//By: Brandon Beckwith
public enum SpaceType {
EMPTY, BLOCK, PATH, INVALID, START, END;
/**
* toString method to make printing the values easier
* @return The abbreviated field.SpaceType
*/
@Override
public String toString() {
switch(this) {
case EMPTY: return "E";
case BLOCK: return "B";
case PATH: return "P";
case INVALID: return "I";
case START: return "S";
case END: return "F";
default: throw new IllegalArgumentException();
}
}
/**
* toColor method to make getting the colors for the board easier
* @return The Color for the field.SpaceType
*/
public Color toColor() {
switch (this){
case INVALID: return Color.MAGENTA;
case PATH: return Colors.Path;
case EMPTY: return Colors.Space;
case BLOCK: return Colors.Block;
case START: return Colors.Start;
case END: return Colors.End;
default: return Color.YELLOW;
}
}
}