Class DigitalAnnotationDecorator

All Implemented Interfaces:
Comparable<Material>

public class DigitalAnnotationDecorator extends MaterialDecorator
Decorator that adds digital annotation functionality to materials. Increases the price and provides annotation management capabilities.
Since:
2024-09-15
Version:
3.0
Author:
Navid Mohaghegh
  • Constructor Details

    • DigitalAnnotationDecorator

      public DigitalAnnotationDecorator(Material material)
      Creates a new digital annotation decorator.
      Parameters:
      material - the material to add annotations to
  • 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
    • addAnnotation

      public void addAnnotation(String annotation)
      Adds an annotation to the material.
      Parameters:
      annotation - the annotation text
      Throws:
      IllegalArgumentException - if annotation is null or empty
    • removeAnnotation

      public String removeAnnotation(int index)
      Removes an annotation by index.
      Parameters:
      index - the index of the annotation to remove
      Returns:
      the removed annotation
      Throws:
      IndexOutOfBoundsException - if index is invalid
    • getAnnotations

      public List<String> getAnnotations()
      Gets all annotations.
      Returns:
      unmodifiable list of annotations
    • getAnnotationCount

      public int getAnnotationCount()
      Gets the number of annotations.
      Returns:
      the annotation count
    • clearAnnotations

      public void clearAnnotations()
      Clears all annotations.
    • getDigitalAnnotationCost

      public double getDigitalAnnotationCost()
      Gets the digital annotation cost.
      Returns:
      the annotation cost
    • hasAnnotations

      public boolean hasAnnotations()
      Checks if the material has any annotations.
      Returns:
      true if annotations exist
    • 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