-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Complete refurbishment of the old Record classes, now named HousingMa…
…rketRecord, HouseBidderRecord, and HouseOfferRecord, including the removal of BTLBuyerRecord
- Loading branch information
1 parent
5eb8193
commit 4dc9e8f
Showing
16 changed files
with
265 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package housing; | ||
|
||
import java.util.Comparator; | ||
|
||
/************************************************************************************************** | ||
* This class encapsulates information on a household that has placed a bid for a house on the | ||
* rental or the ownership housing market. One can think of it as the file an estate agent would | ||
* have on a customer who wants to buy or rent a house. | ||
* | ||
* @author daniel, Adrian Carro | ||
* | ||
*************************************************************************************************/ | ||
public class HouseBidderRecord extends HousingMarketRecord { | ||
|
||
//------------------// | ||
//----- Fields -----// | ||
//------------------// | ||
|
||
private Household bidder; // Household who is bidding to buy or rent a house | ||
private boolean BTLBid; // True if the bid is for a buy-to-let property, false for a home bid (Note that rental bids are all set to false) | ||
|
||
//------------------------// | ||
//----- Constructors -----// | ||
//------------------------// | ||
|
||
HouseBidderRecord(Household h, double price, boolean BTLBid) { | ||
super(price); | ||
this.bidder = h; | ||
this.BTLBid = BTLBid; | ||
} | ||
|
||
//----------------------// | ||
//----- Subclasses -----// | ||
//----------------------// | ||
|
||
/** | ||
* Class that implements a price comparator which solves the case of equal price by using the arguments' IDs. | ||
*/ | ||
public static class PComparator implements Comparator<HouseBidderRecord> { | ||
@Override | ||
public int compare(HouseBidderRecord arg0, HouseBidderRecord arg1) { | ||
double diff = arg0.getPrice() - arg1.getPrice(); | ||
if (diff == 0.0) { | ||
diff = arg0.getId() - arg1.getId(); | ||
} | ||
return (int) Math.signum(diff); | ||
} | ||
} | ||
|
||
//-------------------// | ||
//----- Methods -----// | ||
//-------------------// | ||
|
||
//----- Getter/setter methods -----// | ||
|
||
public Household getBidder() { return bidder; } | ||
|
||
boolean isBTLBid() { return BTLBid; } | ||
|
||
// TODO: Check if the abstract method in HousingMarketRecord class is actually needed, otherwise this could be removed | ||
@Override | ||
public int getQuality() { return 0; } | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.