Class 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
  • 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