# Class ExpeditedDeliveryDecorator

java.lang.Object
com.university.bookstore.model.Material
com.university.bookstore.decorator.MaterialDecorator
com.university.bookstore.decorator.ExpeditedDeliveryDecorator

All Implemented Interfaces:
  `Comparable<Material>`

public class ExpeditedDeliveryDecorator extends MaterialDecorator
Decorator that adds expedited delivery functionality to materials. Increases the price and provides delivery time information.

Since:
  2024-09-15
Version:
  3.0
Author:
  Navid Mohaghegh

- ## Nested Class Summary

  ### Nested classes/interfaces inherited from class com.university.bookstore.model.Material

  `Material.MaterialType`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ExpeditedDeliveryDecorator(Material material, int deliveryDays)`
  Creates a new expedited delivery decorator.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object obj)`
  Materials are equal if they have the same ID.
  `int`
  `getDeliveryDays()`
  Gets the delivery time in days.
  `String`
  `getDisplayInfo()`
  Abstract method to get a formatted display string.
  `double`
  `getExpeditedDeliveryCost()`
  Gets the expedited delivery cost.
  `double`
  `getPrice()`
  `int`
  `hashCode()`

  ### Methods inherited from class com.university.bookstore.decorator.MaterialDecorator

  `getBaseMaterial, getCreator, getDecoratedMaterial, getDecoratorCount, getDiscountRate, hasDecorators, toString`

  ### Methods inherited from class com.university.bookstore.model.Material

  `compareTo, getDiscountedPrice, getId, getTitle, getType, getYear`

  ### Methods inherited from class java.lang.Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### ExpeditedDeliveryDecorator

    public ExpeditedDeliveryDecorator(Material material, int deliveryDays)
    Creates a new expedited delivery decorator.
    Parameters:
      `material` - the material to add expedited delivery to
      `deliveryDays` - the number of days for delivery (minimum 1)
    Throws:
      `IllegalArgumentException` - if deliveryDays is less than 1

- ## Method Details

  - ### getPrice

    public double getPrice()
    Overrides:
      `getPrice` in class `Material`

  - ### getDisplayInfo

    public String getDisplayInfo()
    Description copied from class: `Material`
    Abstract method to get a formatted display string. Each material type should provide its own formatting.
    Overrides:
      `getDisplayInfo` in class `MaterialDecorator`
    Returns:
      formatted display string

  - ### getDeliveryDays

    public int getDeliveryDays()
    Gets the delivery time in days.
    Returns:
      the delivery days

  - ### getExpeditedDeliveryCost

    public double getExpeditedDeliveryCost()
    Gets the expedited delivery cost.
    Returns:
      the expedited delivery cost

  - ### equals

    public boolean equals(Object obj)
    Description copied from class: `Material`
    Materials are equal if they have the same ID.
    Overrides:
      `equals` in class `MaterialDecorator`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `MaterialDecorator`