Git Repository Public Repository

RRRRHHHH_Code

URLs

Copy to Clipboard
 
7bf57b2f0f2b3cf0ae9489a8204918762e64648e
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
package domain;

import java.io.Serializable;
import java.util.Date;
import java.util.Iterator;
import java.util.Vector;

public class RuralHouse implements Serializable {

	private static final long serialVersionUID = 1L;

	private String houseName;
	private String description;
	private Owner owner;
	private String district;
	private HouseFeatures features;
	public Vector<Offer> offers;
	public boolean isAccepted;

	public RuralHouse() {
		super();
	}

	public RuralHouse(String houseName, Owner owner, String description,
			String ds, HouseFeatures features) {
		this.houseName = houseName;
		this.description = description;
		this.owner = owner;
		this.district = ds;
		this.features = features;
		offers = new Vector<Offer>();
	}

	public String getHouseName() {
		return houseName;
	}

	public void setHouseName(String houseName) {
		this.houseName = houseName;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Owner getOwner() {
		return owner;
	}

	public void setOwner(Owner owner) {
		this.owner = owner;
	}

	public String getDistrict() {
		return district;
	}

	public void setDistrict(String ds) {
		this.district = ds;
	}

	public HouseFeatures getFeatures() {
		return features;
	}

	public void setFeatures(HouseFeatures features) {
		this.features = features;
	}

	public String toString() {
		return this.houseName + ": " + this.district;
	}

	public Offer createOffer(int offerNumber, Date firstDay, Date lastDay,
			float price) {
		Offer off = new Offer(offerNumber, this, firstDay, lastDay, price);
		offers.add(off);
		return off;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		RuralHouse other = (RuralHouse) obj;
		if (houseName == null) {
			if (other.houseName != null)
				return false;
		} else if (!houseName.equals(other.houseName))
			return false;
		return true;
	}

	/**
	 * This method obtains available offers for a concrete house in a certain
	 * period
	 * 
	 * @param houseName
	 *            , the house number where the offers must be obtained
	 * @param firstDay
	 *            , first day in a period range
	 * @param lastDay
	 *            , last day in a period range
	 * @return a vector of offers(Offer class) available in this period
	 */
	public Vector<Offer> getOffers(Date firstDay, Date lastDay) {
		Vector<Offer> availableOffers = new Vector<Offer>();
		Iterator<Offer> e = offers.iterator();
		Offer offer;
		while (e.hasNext()) {
			offer = e.next();
			if ((offer.getFirstDay().compareTo(firstDay) >= 0)
					&& (offer.getLastDay().compareTo(lastDay) <= 0)
					&& (offer.getBooking() == null))
				availableOffers.add(offer);
		}
		return availableOffers;
	}

	public Vector<Offer> getAllOffers() {

		return this.offers;
	}

//	/**
//	 * This method obtains the offer that match exactly with a given dates that
//	 * has not been booked
//	 * 
//	 * @param firstDay
//	 *            , first day in a period range
//	 * @param lastDay
//	 *            , last day in a period range
//	 * @return the offer(Offer class) available for a this period
//	 */
//	public Offer findOffer(Date firstDay, Date lastDay) {
//		Iterator<Offer> e = offers.iterator();
//		Offer offer = null;
//		while (e.hasNext()) {
//			offer = e.next();
//			if ((offer.getFirstDay().compareTo(firstDay) == 0)
//					&& (offer.getLastDay().compareTo(lastDay) == 0)
//					&& (offer.getBooking() == null))
//				return offer;
//		}
//		return null;
//	}

	public Offer overlapsWith(Date firstDay, Date lastDay) {

		Iterator<Offer> e = offers.iterator();
		Offer offer = null;
		while (e.hasNext()) {
			offer = e.next();
			if ((offer.getFirstDay().compareTo(lastDay) < 0)
					&& (offer.getLastDay().compareTo(firstDay) > 0))
				return offer;
		}
		return null;

	}

}

Commits for RRRRHHHH_CoderuralHouses/src/domain/RuralHouse.java

Diff revisions: vs.
Revision Author Commited Message
7bf57b ... Diff Diff camjan Sun 17 May, 2015 11:59:22 +0000

Possibility of registering new owners added

0f75b2 ... Diff Diff camjan Sat 16 May, 2015 14:34:49 +0000

Username is saved hashed and password hashed and salted

d7fd17 ... Diff Diff Eneko Pinzolas Murua Mon 27 Apr, 2015 12:01:38 +0000

Started creating the booking interface for the owners.

46d6c3 ... Diff Diff camjan Wed 15 Apr, 2015 17:08:42 +0000

Debbugin continues...

5761bc ... Diff Diff camjan Wed 15 Apr, 2015 15:27:07 +0000

Bugs when deleting houses and offers fixed and GUI’s adapated for empty cases

cff7b0 ... Diff Diff camjan Wed 08 Apr, 2015 11:57:07 +0000

House features gui created

5ad0cc ... Diff Diff Eneko Pinzolas Murua Wed 01 Apr, 2015 17:46:59 +0000

ModifyHouseGUI created and its link from HouseRelatedOwnerGUI reestablished

7c0734 ... Diff Diff Eneko Pinzolas Murua Tue 10 Mar, 2015 12:15:11 +0000

house code changed to name

06a849 ... Diff Diff pinene picture pinene Sat 07 Mar, 2015 13:48:38 +0000

unification with the actual initial project. Some things are new now, but there has been a feature that has been deleted.\n The feature of opening and closing the database per each query/store has been deleted by now

a92725 ... pinene picture pinene Fri 06 Mar, 2015 09:41:12 +0000

implemented lacking GUIs and corrected errors