-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLocation.java
More file actions
47 lines (38 loc) · 1.18 KB
/
Location.java
File metadata and controls
47 lines (38 loc) · 1.18 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
40
41
42
43
44
45
46
47
package com.dj;
import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* Created by dev on 8/12/2015.
*/
public class Location implements Serializable {
private final int locationID;
private final String description;
private final Map<String, Integer> exits;
private long serialVersionUID = 1L;
public Location(int locationID, String description, Map<String, Integer> exits) {
this.locationID = locationID;
this.description = description;
if(exits != null) {
this.exits = new LinkedHashMap<String, Integer>(exits);
} else {
this.exits = new LinkedHashMap<String, Integer>();
}
this.exits.put("Q", 0);
}
// public void addExit(String direction, int location) {
// exits.put(direction, location);
// }
public int getLocationID() {
return locationID;
}
public String getDescription() {
return description;
}
public Map<String, Integer> getExits() {
return new LinkedHashMap<String, Integer>(exits);
}
protected void addExit(String direction, int location) {
exits.put(direction, location);
}
}