Refactor and rename project

This commit is contained in:
Santiago Lo Coco 2024-02-26 14:42:08 +01:00
parent 00e8919617
commit 13b5c7f421
11 changed files with 17 additions and 10 deletions

View File

@ -14,31 +14,38 @@ The project consists of the following components:
- **LibraryDecorator:** An abstract class for extending functionality of the Library. - **LibraryDecorator:** An abstract class for extending functionality of the Library.
- **IncreaseBooksCapacityDecorator:** A concrete decorator to increase the books capacity of the Library. - **IncreaseBooksCapacityDecorator:** A concrete decorator to increase the books capacity of the Library.
- **DecreaseBooksCapacityDecorator:** A concrete decorator to decrease the books capacity of the Library. - **DecreaseBooksCapacityDecorator:** A concrete decorator to decrease the books capacity of the Library.
- **Test:** Contains the main method to demonstrate the library system. - **App:** Contains the main method to demonstrate the library system.
## Design Patterns Used ## Design Patterns Used
- **Builder Pattern:** Used in the LibraryBuilder class to construct the library by adding books and magazines. - **Builder Pattern:** Used in the LibraryBuilder class to construct the library by adding books and magazines.
- **Singleton Pattern:** Implemented in the Library class to ensure only one instance of the library exists throughout the application. - **Singleton Pattern:** Implemented in the Library class to ensure only one instance of the library exists throughout the application.
- **Decorator Pattern:** Implemented with LibraryDecorator and its concrete decorators (IncreaseBooksCapacityDecorator and DecreaseBooksCapacityDecorator) to extend the functionality of the Library dynamically. - **Decorator Pattern:** Implemented with LibraryDecorator and its concrete decorators (IncreaseBooksCapacityDecorator and DecreaseBooksCapacityDecorator) to extend the functionality of the Library dynamically.
- **Iterator Pattern:** Implemented in the Library class to provide a way to iterate over its collection of items. - **Iterator Pattern:** Implemented by custom iterators in the Library class to iterate over the collection of items.
## Prerequisites ## Prerequisites
Before you begin, ensure you have met the following requirements: Before you begin, ensure you have met the following requirements:
- Maven version 3 or higher - Maven >= 3
- Java version 11 or higher - Java >= 11
## Usage ## Usage
To run the project: To run the project, first clone or download the repository to your local machine. Now, you have two options: using an IDE or using the CLI (terminal).
1. Clone or download the repository to your local machine. ### IDE
2. Open the project in your preferred Java IDE.
3. Run the Test class.
The Test class demonstrates the following functionalities: 1. Open the project in your preferred Java IDE.
2. Run the `App` class.
### CLI
```sh
mvn compile exec:java
```
The `App` class demonstrates the following functionalities:
- Creation of books and magazines. - Creation of books and magazines.
- Adding items to the library. - Adding items to the library.

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>edu.uastw</groupId> <groupId>edu.uastw</groupId>
<artifactId>test</artifactId> <artifactId>library</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<properties> <properties>