diff --git a/uml/classdiagram1.dot b/uml/classdiagram1.dot new file mode 100755 index 0000000..e23bb51 --- /dev/null +++ b/uml/classdiagram1.dot @@ -0,0 +1,110 @@ +digraph ClassDiagram { + graph [ + rankdir="TB", + splines=ortho, + nodesep=1.0, + ranksep=1.2 + ]; + node [ + shape=record, + style=filled, + fillcolor=lightyellow, + fontname="Helvetica,Arial,sans-serif" + ]; + edge [ + fontname="Helvetica,Arial,sans-serif" + ]; + + // --- Interfaces --- + IReservation [ + label="{interface\nIReservation|+ ReservationType(): String\l+ checkValid(): boolean\l+ calculatePrice(): float\l+ getReservation_number(): String\l+ getPhysical_address(): Address\l+ getAccountNumber(): String\l}", + fillcolor=palegreen + ]; + + // --- Abstract Classes --- + Reservation [ + label="{abstract\nReservation|+ {abstract} ReservationType(): String\l+ Write(Reservation): void\l+ Change(Reservation, ReservationStatusEnum): void\l+ update(Reservation): void\l+ calculatePrice(): float\l+ setMailing_address(Address): void\l+ setNumberOfBeds(int): void\l+ setNumberOfFloors(int): void\l+ setNumberOfBedRooms(int): void\l+ setSquareFeet(int): void\l+ setReservation_start_date(ZonedDateTime): void\l+ setReservation_end_date(ZonedDateTime): void\l}", + fontstyle=italic + ]; + + // --- Concrete Classes --- + AccomodationManager [ + label="{AccomodationManager|+ AccomodationManager(String)\l+ loadAll(): void\l+ retrieveAccount(String): Account\l+ retrieveLoadedAccounts(): AccountList\l+ newAccount(String, Address, EmailAddress): Account\l+ AddAccount(Account): void\l+ UpdateAccount(Account): void\l+ addReservation(Account, Reservation): boolean\l+ showReservationList(): void\l}" + ]; + + DataRepository [ + label="{DataRepository (Singleton)|+ {static} getInstance(): DataRepository\l+ {static} setDataStoreRoot(String): void\l+ {static} WalkFileSystemTree(AccomodationManager, Path): void\l+ {static} LoadAccount(Path): Account\l}", + fillcolor=orchid + ]; + + Account [ + label="{Account|+ add(Reservation): boolean\l+ findReservation(String): Reservation\l+ getAllReservations(): Iterator\l+ getAccount_number(): String\l+ {static} Write(Account): void\l}" + ]; + + AccountList [ + label="{AccountList|+ add(Account): boolean\l+ find(String): Account\l+ save(Account): void\l}" + ]; + + AccountReservationList [ + label="{AccountReservationList|+ add(IReservation): boolean\l+ find(String): Reservation\l}" + ]; + + HotelReservation [ + label="{HotelReservation|+ HotelReservation(Address)\l+ calculatePrice(): float\l}" + ]; + CabinReservation [ + label="{CabinReservation|+ CabinReservation(Address)\l+ calculatePrice(): float\l}" + ]; + HouseReservation [ + label="{HouseReservation|+ HouseReservation(Address)\l+ calculatePrice(): float\l}" + ]; + + TestReservations [ + label="{TestReservations|+ {static} main(String[]): void\l}" + ]; + + "TestReservations.getRepositoryConfig" [ + label="{static class\ngetRepositoryConfig|+ {static} getPath(): String\l}" + ]; + + // --- Data/Enum/Exception Classes --- + Address [label="{Address|+ Address(String, String, String, String)\l}", fillcolor=lightblue]; + EmailAddress [label="{EmailAddress|+ EmailAddress(String)\l}", fillcolor=lightblue]; + ReservationStatusEnum [label="{enum\nReservationStatusEnum}", fillcolor=lightgray]; + DuplicateObjectException [label="{exception\nDuplicateObjectException}", fillcolor=lightpink]; + + // --- Relationships --- + + // Inheritance / Implementation + Reservation -> IReservation [arrowhead=empty, style=dashed, label="implements"]; + HotelReservation -> Reservation [arrowhead=empty, label="extends"]; + CabinReservation -> Reservation [arrowhead=empty, label="extends"]; + HouseReservation -> Reservation [arrowhead=empty, label="extends"]; + + // Composition / Aggregation + AccomodationManager -> AccountList [arrowhead=diamond, label="has a"]; + AccountList -> Account [arrowhead=diamond, label="0..*"]; + Account -> AccountReservationList [arrowhead=diamond, label="has a"]; + AccountReservationList -> IReservation [arrowhead=diamond, label="0..*"]; + Account -> Address [arrowhead=odiamond, label="mailing"]; + Account -> EmailAddress [arrowhead=odiamond]; + Reservation -> Address [arrowhead=odiamond, label="physical/mailing"]; + + // Dependencies + TestReservations -> AccomodationManager [arrowhead=vee, style=dashed, label="uses"]; + TestReservations -> "TestReservations.getRepositoryConfig" [arrowhead=vee, style=dashed, label="uses"]; + TestReservations -> HotelReservation [arrowhead=vee, style=dashed, label="creates"]; + TestReservations -> CabinReservation [arrowhead=vee, style=dashed, label="creates"]; + TestReservations -> HouseReservation [arrowhead=vee, style=dashed, label="creates"]; + TestReservations -> Account [arrowhead=vee, style=dashed, label="uses"]; + TestReservations -> Address [arrowhead=vee, style=dashed, label="creates"]; + TestReservations -> EmailAddress [arrowhead=vee, style=dashed, label="creates"]; + TestReservations -> DuplicateObjectException [arrowhead=vee, style=dashed, label="catches"]; + + AccomodationManager -> DataRepository [arrowhead=vee, style=dashed, label="uses"]; + AccomodationManager -> Account [arrowhead=vee, style=dashed, label="manages"]; + + Account -> DataRepository [arrowhead=vee, style=dashed, label="uses for Write()"]; + Reservation -> DataRepository [arrowhead=vee, style=dashed, label="uses for Write()"]; + Reservation -> ReservationStatusEnum [arrowhead=vee, style=dashed, label="uses"]; +} diff --git a/uml/classdiagram1.svg b/uml/classdiagram1.svg new file mode 100755 index 0000000..404bebb --- /dev/null +++ b/uml/classdiagram1.svg @@ -0,0 +1,323 @@ + + + + + + +ClassDiagram + + + +IReservation + +interface +IReservation + ++ ReservationType(): String ++ checkValid(): boolean ++ calculatePrice(): float ++ getReservation_number(): String ++ getPhysical_address(): Address ++ getAccountNumber(): String + + + +Reservation + +Reservation + + + +Reservation->IReservation + + +implements + + + +DataRepository + +DataRepository + + + +Reservation->DataRepository + + +uses for Write() + + + +Address + +Address + ++ Address(String, String, String, String) + + + +Reservation->Address + + +physical/mailing + + + +ReservationStatusEnum + +enum +ReservationStatusEnum + + + +Reservation->ReservationStatusEnum + + +uses + + + +AccomodationManager + +AccomodationManager + ++ AccomodationManager(String) ++ loadAll(): void ++ retrieveAccount(String): Account ++ retrieveLoadedAccounts(): AccountList ++ newAccount(String, Address, EmailAddress): Account ++ AddAccount(Account): void ++ UpdateAccount(Account): void ++ addReservation(Account, Reservation): boolean ++ showReservationList(): void + + + +AccomodationManager->DataRepository + + +uses + + + +Account + +Account + + + +AccomodationManager->Account + + +manages + + + +AccountList + +AccountList + ++ add(Account): boolean ++ find(String): Account ++ save(Account): void + + + +AccomodationManager->AccountList + + +has a + + + +Account->DataRepository + + +uses for Write() + + + +AccountReservationList + +AccountReservationList + ++ add(IReservation): boolean ++ find(String): Reservation + + + +Account->AccountReservationList + + +has a + + + +Account->Address + + +mailing + + + +EmailAddress + +EmailAddress + ++ EmailAddress(String) + + + +Account->EmailAddress + + + + + +AccountList->Account + + +0..* + + + +AccountReservationList->IReservation + + +0..* + + + +HotelReservation + +HotelReservation + ++ HotelReservation(Address) ++ calculatePrice(): float + + + +HotelReservation->Reservation + + +extends + + + +CabinReservation + +CabinReservation + ++ CabinReservation(Address) ++ calculatePrice(): float + + + +CabinReservation->Reservation + + +extends + + + +HouseReservation + +HouseReservation + ++ HouseReservation(Address) ++ calculatePrice(): float + + + +HouseReservation->Reservation + + +extends + + + +TestReservations + +TestReservations + + + +TestReservations->AccomodationManager + + +uses + + + +TestReservations->Account + + +uses + + + +TestReservations->HotelReservation + + +creates + + + +TestReservations->CabinReservation + + +creates + + + +TestReservations->HouseReservation + + +creates + + + +TestReservations.getRepositoryConfig + +TestReservations.getRepositoryConfig + + + +TestReservations->TestReservations.getRepositoryConfig + + +uses + + + +TestReservations->Address + + +creates + + + +TestReservations->EmailAddress + + +creates + + + +DuplicateObjectException + +exception +DuplicateObjectException + + + +TestReservations->DuplicateObjectException + + +catches + + +