This repository was archived by the owner on Dec 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRealEstate.java
More file actions
54 lines (43 loc) · 1.32 KB
/
Copy pathRealEstate.java
File metadata and controls
54 lines (43 loc) · 1.32 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
54
import java.util.Comparator;
/* This is a superclass for all varieties of real estate types.
* Its most noticeable parameter is the 'requests' PriorityTwoQueue.
* This is used for storing the requests based on priority (VIP or Regular client).
* Author: Seppe Lampe
*/
public class RealEstate implements Comparable{
protected String street;
protected int bedrooms;
protected int bathrooms;
protected int price;
protected int id;
protected PriorityTwoQueue requests;
public RealEstate(String street, int bedrooms, int bathrooms, int price, int id) {
this.street = street;
this.bedrooms = bedrooms;
this.bathrooms = bathrooms;
this.price = price;
this.id = id;
this.requests = new PriorityTwoQueue();
}
public String getStreet() { //O(1)
return street;
}
public int getBedrooms() { //O(1)
return bedrooms;
}
public int getBathrooms() { //O(1)
return bathrooms;
}
public int getPrice() { //O(1)
return price;
}
public int getId() { //O(1)
return id;
}
public PriorityTwoQueue getRequests() { //O(1)
return requests;
}
public int compareTo(Object structure) { //O(1)
return id - ((RealEstate)structure).getId(); // Comparing is done based on id since this parameter is unique.
}
}