update
This commit is contained in:
@@ -6,6 +6,7 @@ package lodge.reservationsystem;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public final class AccomodationManager {
|
||||
@@ -44,8 +45,8 @@ public final class AccomodationManager {
|
||||
}
|
||||
}
|
||||
|
||||
public final AccountList retrieveLoadedAccounts() {
|
||||
return account_list;
|
||||
public final List<Account> retrieveLoadedAccounts() {
|
||||
return Collections.unmodifiableList(account_list);
|
||||
}
|
||||
|
||||
public Account retrieveAccount(String acct_id) {
|
||||
|
||||
@@ -10,11 +10,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
public class AccountList extends ArrayList<Account> {
|
||||
|
||||
public AccountList() {
|
||||
super();
|
||||
}
|
||||
class AccountList extends ArrayList<Account> {
|
||||
|
||||
public static String accountSerial(String phone_number, Address mailing_address, EmailAddress email_address) {
|
||||
return String.format("A%09d", Math.abs(java.util.Objects.hash(phone_number, mailing_address, email_address)));
|
||||
@@ -55,10 +51,6 @@ public class AccountList extends ArrayList<Account> {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<Account> getList() {
|
||||
return Collections.unmodifiableList(this);
|
||||
}
|
||||
|
||||
public List<? extends Reservation> getListOfReservations() {
|
||||
ArrayList<Reservation> readList = new ArrayList<>();
|
||||
for (Account acct: this){
|
||||
|
||||
@@ -6,7 +6,7 @@ package lodge.reservationsystem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class AccountReservationList extends ArrayList<Reservation> {
|
||||
class AccountReservationList extends ArrayList<Reservation> {
|
||||
|
||||
private static String reservationSerial(Reservation reservation) {
|
||||
return String.format("R%010d", Math.abs(java.util.Objects.hash(reservation.getPhysical_address())));
|
||||
@@ -16,7 +16,7 @@ public class AccountReservationList extends ArrayList<Reservation> {
|
||||
public synchronized boolean add(final Reservation reservation) throws RuntimeException{
|
||||
boolean result = true;
|
||||
Reservation rsrv = this.find(reservation.getReservation_number());
|
||||
result = rsrv == null;
|
||||
result = rsrv == null;
|
||||
if( !result ){
|
||||
throw new DuplicateObjectException(String.format("Error No Dups, Reservation exists: %s.", rsrv.getReservation_number()));
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public final class CabinReservation extends Reservation {
|
||||
protected CabinReservation() {
|
||||
setType('C');
|
||||
this.setNumberOfBeds(1);
|
||||
this.setKitchen(KitchenEnum.Kitchenette);
|
||||
this.setKitchen(KitchenTypeEnum.Kitchenette);
|
||||
}
|
||||
|
||||
public CabinReservation(final Address physical_address) {
|
||||
@@ -55,7 +55,7 @@ public final class CabinReservation extends Reservation {
|
||||
long days = ChronoUnit.DAYS.between(startdt, enddt);
|
||||
days = (days < 2) ? 1 : days - 1;
|
||||
float calcprice = (getSquareFeet() > 900.0f) ? 120.0f + 15.0f : 120.0f;
|
||||
if (getKitchen() == KitchenEnum.FullKitchen) {
|
||||
if (getKitchen() == KitchenTypeEnum.FullKitchen) {
|
||||
calcprice = calcprice + 20.0f;
|
||||
}
|
||||
if (getNumberOfBathRooms() > 1) {
|
||||
|
||||
@@ -211,7 +211,7 @@ final class DataRepository {
|
||||
rsrv.setReservation_status(ReservationStatusEnum.valueOf(jsonReader.nextString()));
|
||||
break;
|
||||
case "kitchen":
|
||||
rsrv.setKitchen(KitchenEnum.valueOf(jsonReader.nextString()));
|
||||
rsrv.setKitchen(KitchenTypeEnum.valueOf(jsonReader.nextString()));
|
||||
break;
|
||||
case "numberOfBeds":
|
||||
rsrv.setNumberOfBeds(Integer.valueOf(jsonReader.nextString()));
|
||||
|
||||
@@ -17,7 +17,7 @@ public final class HotelReservation extends Reservation {
|
||||
this.setNumberOfBedRooms(1);
|
||||
this.setNumberOfBathRooms(1);
|
||||
this.setNumberOfFloors(1);
|
||||
this.setKitchen(KitchenEnum.Kitchenette);
|
||||
this.setKitchen(KitchenTypeEnum.Kitchenette);
|
||||
}
|
||||
|
||||
public HotelReservation(final Address physical_address) {
|
||||
@@ -73,7 +73,7 @@ public final class HotelReservation extends Reservation {
|
||||
}
|
||||
|
||||
float calcprice = (getSquareFeet() > 900.0f) ? 120.0f + 15.0f : 120.0f;
|
||||
if (getKitchen() == KitchenEnum.FullKitchen) {
|
||||
if (getKitchen() == KitchenTypeEnum.FullKitchen) {
|
||||
calcprice = calcprice + 10.0f;
|
||||
}
|
||||
calcprice = calcprice * days;
|
||||
|
||||
@@ -15,7 +15,7 @@ public final class HouseReservation extends Reservation {
|
||||
this.setNumberOfBedRooms(1);
|
||||
this.setNumberOfBathRooms(1);
|
||||
this.setNumberOfFloors(1);
|
||||
this.setKitchen(KitchenEnum.Kitchenette);
|
||||
this.setKitchen(KitchenTypeEnum.Kitchenette);
|
||||
}
|
||||
|
||||
public HouseReservation(final Address physical_address) {
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
*/
|
||||
package lodge.reservationsystem;
|
||||
|
||||
public enum KitchenEnum {
|
||||
public enum KitchenTypeEnum {
|
||||
None, Kitchenette, FullKitchen;
|
||||
}
|
||||
@@ -22,7 +22,7 @@ public abstract class Reservation{
|
||||
private ZonedDateTime reservation_end_date;
|
||||
private ReservationStatusEnum reservation_status;
|
||||
|
||||
private KitchenEnum kitchen;
|
||||
private KitchenTypeEnum kitchen;
|
||||
|
||||
private Integer numberOfBeds;
|
||||
private Integer numberOfBedRooms;
|
||||
@@ -39,7 +39,7 @@ public abstract class Reservation{
|
||||
numberOfBedRooms = 1;
|
||||
numberOfBathRooms = 1;
|
||||
numberOfFloors = 1;
|
||||
kitchen = KitchenEnum.None;
|
||||
kitchen = KitchenTypeEnum.None;
|
||||
price = 120.0f;
|
||||
reservation_status = ReservationStatusEnum.Draft;
|
||||
mailing_address = null;
|
||||
@@ -86,11 +86,11 @@ public abstract class Reservation{
|
||||
this.reservation_status = reservation_status;
|
||||
}
|
||||
|
||||
public KitchenEnum getKitchen() {
|
||||
public KitchenTypeEnum getKitchen() {
|
||||
return kitchen;
|
||||
}
|
||||
|
||||
public void setKitchen(KitchenEnum kitchen) {
|
||||
public void setKitchen(KitchenTypeEnum kitchen) {
|
||||
this.kitchen = kitchen;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user