forked from loopccoew/Buffer-4.0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPropertyNode.java
109 lines (89 loc) · 2.64 KB
/
PropertyNode.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package Buffer;
import java.util.*;
public class PropertyNode {
private int id;
private String name;
private int size;
private int price;
private String amenities;
private String phoneNumber;
private boolean available;
private SpecialNode area;
private ArrayList<PropertyNode> neighbors;
private Queue<BookingRequest> bookingRequestQueue;
public PropertyNode(int id, String name, int size, int price, String amenities, String phoneNumber, boolean available, SpecialNode area) {
this.id = id;
this.name = name;
this.size = size;
this.price = price;
this.amenities = amenities;
this.phoneNumber = phoneNumber;
this.available = available;
this.area = area;
this.neighbors = new ArrayList<PropertyNode>();
this.bookingRequestQueue = new LinkedList<>();
}
public int getId() {
return id;
}
public String getName() {
return name;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size=size;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price=price;
}
public String getAmenities() {
return amenities;
}
public void setAmenities(String amenities ) {
this.amenities=amenities;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber ) {
this.phoneNumber=phoneNumber;
}
public boolean isAvailable() {
return available;
}
public void setAvailable(boolean available) {
this.available = available;
}
public SpecialNode getArea() {
return area;
}
public ArrayList<PropertyNode> getNeighbors() {
return neighbors;
}
public void addNeighbor(PropertyNode neighbor) {
neighbors.add(neighbor);
}
public void removeNeighbor(PropertyNode neighbor) {
neighbors.remove(neighbor);
}
public void addBookingRequest(BookingRequest bookingRequest) {
this.bookingRequestQueue.offer(bookingRequest);
}
public Queue<BookingRequest> getBookingRequestQueue() {
return bookingRequestQueue;
}
public Queue<BookingRequest> getBookings() {
Queue<BookingRequest> bookings = new LinkedList<>();
for (BookingRequest bookingRequest : bookingRequestQueue) {
if (bookingRequest.getProperty().isAvailable() && !bookings.contains(bookingRequest)) {
bookings.offer(bookingRequest);
}
}
return bookings;
}
}