|
@@ -9,19 +9,20 @@ |
9 |
9 |
|
|
10 |
10 |
|
private static final long serialVersionUID = 1L; |
11 |
11 |
|
|
12 |
|
- |
private int houseNumber; |
|
12 |
+ |
private String houseName; |
13 |
13 |
|
private String description; |
14 |
14 |
|
private Owner owner; |
15 |
15 |
|
private String town; |
16 |
16 |
|
private HouseFeatures features; |
17 |
17 |
|
public Vector<Offer> offers; |
|
18 |
+ |
public boolean isAccepted; |
18 |
19 |
|
|
19 |
20 |
|
public RuralHouse() { |
20 |
21 |
|
super(); |
21 |
22 |
|
} |
22 |
23 |
|
|
23 |
|
- |
public RuralHouse(int houseNumber, Owner owner, String description, String town ,HouseFeatures features) { |
24 |
|
- |
this.houseNumber = houseNumber; |
|
24 |
+ |
public RuralHouse(String houseName, Owner owner, String description, String town , HouseFeatures features) { |
|
25 |
+ |
this.houseName = houseName; |
25 |
26 |
|
this.description = description; |
26 |
27 |
|
this.owner = owner; |
27 |
28 |
|
this.town = town; |
|
@@ -31,12 +32,12 @@ |
31 |
32 |
|
|
32 |
33 |
|
|
33 |
34 |
|
|
34 |
|
- |
public int getHouseNumber() { |
35 |
|
- |
return houseNumber; |
|
35 |
+ |
public String getHouseName() { |
|
36 |
+ |
return houseName; |
36 |
37 |
|
} |
37 |
38 |
|
|
38 |
|
- |
public void setHouseNumber(int houseNumber) { |
39 |
|
- |
this.houseNumber = houseNumber; |
|
39 |
+ |
public void setHouseName(String houseName) { |
|
40 |
+ |
this.houseName = houseName; |
40 |
41 |
|
} |
41 |
42 |
|
|
42 |
43 |
|
public String getDescription() { |
|
@@ -70,7 +71,7 @@ |
70 |
71 |
|
this.features = features; |
71 |
72 |
|
} |
72 |
73 |
|
public String toString() { |
73 |
|
- |
return this.houseNumber + ": " + this.town; |
|
74 |
+ |
return this.houseName + ": " + this.town; |
74 |
75 |
|
} |
75 |
76 |
|
|
76 |
77 |
|
public Offer createOffer(int offerNumber,Date firstDay, Date lastDay, float price) { |
|
@@ -80,13 +81,8 @@ |
80 |
81 |
|
} |
81 |
82 |
|
|
82 |
83 |
|
|
83 |
|
- |
@Override |
84 |
|
- |
public int hashCode() { |
85 |
|
- |
final int prime = 31; |
86 |
|
- |
int result = 1; |
87 |
|
- |
result = prime * result + houseNumber; |
88 |
|
- |
return result; |
89 |
|
- |
} |
|
84 |
+ |
|
|
85 |
+ |
|
90 |
86 |
|
|
91 |
87 |
|
@Override |
92 |
88 |
|
public boolean equals(Object obj) { |
|
@@ -97,15 +93,15 @@ |
97 |
93 |
|
if (getClass() != obj.getClass()) |
98 |
94 |
|
return false; |
99 |
95 |
|
RuralHouse other = (RuralHouse) obj; |
100 |
|
- |
if (houseNumber != other.houseNumber) |
|
96 |
+ |
if (houseName != other.houseName) |
101 |
97 |
|
return false; |
102 |
98 |
|
return true; |
103 |
99 |
|
} |
104 |
100 |
|
|
105 |
|
- |
public String getAccountNumber(int houseNumber) { |
|
101 |
+ |
public String getAccountNumber(int houseName) { |
106 |
102 |
|
/*try { |
107 |
103 |
|
dbMngr=DBManager.getInstance(); |
108 |
|
- |
return dbMngr.getOwner(houseNumber).getBankAccount(); |
|
104 |
+ |
return dbMngr.getOwner(houseName).getBankAccount(); |
109 |
105 |
|
|
110 |
106 |
|
} catch (Exception e) { |
111 |
107 |
|
System.out.println("Error, accessing to DB Manager: " |
|
@@ -117,7 +113,7 @@ |
117 |
113 |
|
/** |
118 |
114 |
|
* This method obtains available offers for a concrete house in a certain period |
119 |
115 |
|
* |
120 |
|
- |
* @param houseNumber, the house number where the offers must be obtained |
|
116 |
+ |
* @param houseName, the house number where the offers must be obtained |
121 |
117 |
|
* @param firstDay, first day in a period range |
122 |
118 |
|
* @param lastDay, last day in a period range |
123 |
119 |
|
* @return a vector of offers(Offer class) available in this period |