-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLocation.java
More file actions
30 lines (25 loc) · 768 Bytes
/
Copy pathLocation.java
File metadata and controls
30 lines (25 loc) · 768 Bytes
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
import java.util.HashMap;
import java.util.Map;
public class Location {
private final int locationID;
private final String description;
private final Map<String, Integer> exits;
public Location(int locationID, String description) {
this.locationID = locationID;
this.description = description;
this.exits = new HashMap<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 HashMap<String, Integer>(exits);
}
}