-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathBuildingInfo.java
More file actions
53 lines (41 loc) · 1.05 KB
/
BuildingInfo.java
File metadata and controls
53 lines (41 loc) · 1.05 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
48
49
50
51
52
53
package immutable;
class Building {
private String name;
private String location;
public Building(String n, String l) {
this.location = l;
this.name = n;
}
public String getLocation() {
return location;
}
public String getName() {
return name;
}
public String toString() {
return "name:" + name + ", location:" + location;
}
public void setLocation(String location) {
this.location = location;
}
public void setName(String name) {
this.name = name;
}
}
public final class BuildingInfo {
private final Building building;
private final int buildingID;
public BuildingInfo(Building b, int id) {
this.building = new Building(b.getName(), b.getLocation());
this.buildingID = id;
}
public final int getBuildingID() {
return buildingID;
}
public final Building getBuilding() {
return building;
}
public String toString() {
return "id:" + buildingID + ",Info:" + building;
}
}