-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFeatureTypeEnum.java
68 lines (64 loc) · 1.85 KB
/
FeatureTypeEnum.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
enum FeatureTypeEnum {
//Holds names for feature types that represent integers
Jungle,
Trail,
Lake,
Shore,
TrailEnd,
InnerShore,
Den,
None;
public int toInt(){
switch(this){
case Jungle: return 0;
case Trail: return 1;
case Lake: return 2;
case Shore: return 3;
case TrailEnd: return 4;
case InnerShore: return 5;
case Den: return 6;
case None: return 9;
default: throw new IllegalStateException();
}
}
public char toChar(){
switch(this){
case Jungle: return 'F';
case Trail: return 'R';
case TrailEnd: return 'E';
case Lake: return 'C';
case Shore: return 'W';
case InnerShore: return 'I';
case Den: return 'M';
case None: return 'X';
default: throw new IllegalStateException();
}
}
public boolean isSameFeature(FeatureTypeEnum otherType){
switch (this){
case Jungle:
return otherType == Jungle;
case Trail:
case TrailEnd:
return (otherType == Trail || otherType == TrailEnd);
case Lake:
case Shore:
case InnerShore:
return (otherType == Lake || otherType == Shore || otherType == InnerShore);
case Den:
return (otherType == Den);
case None:
return (otherType == None);
default: throw new IllegalStateException();
}
}
public boolean isShoreToLake(FeatureTypeEnum otherType){
switch (this){
case Lake:
case Shore:
return (otherType == Lake || otherType == Shore);
default:
return false;
}
}
}