/State-Design-Pattern

The state is a behavioral design pattern that lets an object alter its behavior when its internal state changes. It appears as if the object changed its class.

Primary LanguageJava

State Design Pattern

The repository contains an implementation of the State Design Pattern. The implementation has been done for a Book object in the context of a Library Management System. The book object can have multiple states. They are:

  • Available
  • Issued
  • Reserved
  • Lost

Directory Structure

📦State-Design-Pattern
 ┣ 📂src
 ┃ ┗ 📂StatePattern
 ┃ ┃ ┣ 📜Available.java
 ┃ ┃ ┣ 📜BookContext.java
 ┃ ┃ ┣ 📜BookState.java
 ┃ ┃ ┣ 📜Issued.java
 ┃ ┃ ┣ 📜Main.java
 ┃ ┃ ┗ 📜Reserved.java
 ┣ 📜.gitignore
 ┣ 📜README.md
 ┗ 📜StatePattern.iml