Class VideoMaterial

java.lang.Object
com.university.bookstore.model.Material
com.university.bookstore.model.VideoMaterial
All Implemented Interfaces:
Media, Comparable<Material>

public class VideoMaterial extends Material implements Media
Represents video content (movies, documentaries, educational videos). Implements both Material and Media interfaces to demonstrate multiple inheritance.
Since:
2024-09-15
Version:
2.0
Author:
Navid Mohaghegh
  • Constructor Details

    • VideoMaterial

      public VideoMaterial(String id, String title, String director, double price, int year, int duration, String format, double fileSize, Media.MediaQuality quality, VideoMaterial.VideoType videoType, String rating, List<String> cast, boolean subtitlesAvailable, String aspectRatio)
      Creates a new VideoMaterial.
      Parameters:
      id - unique identifier (UPC/EAN code)
      title - video title
      director - director or producer
      price - price in dollars
      year - release year
      duration - duration in minutes
      format - video format (MP4, AVI, MKV, etc.)
      fileSize - size in megabytes
      quality - video quality
      videoType - type of video
      rating - content rating (G, PG, PG-13, R, etc.)
      cast - list of main cast members
      subtitlesAvailable - whether subtitles are included
      aspectRatio - aspect ratio (16:9, 4:3, etc.)
  • Method Details

    • getCreator

      public String getCreator()
      Description copied from class: Material
      Abstract method to get the creator/author/artist of the material. Implementation varies by material type.
      Specified by:
      getCreator in class Material
      Returns:
      the creator's name
    • 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.
      Specified by:
      getDisplayInfo in class Material
      Returns:
      formatted display string
    • getDuration

      public int getDuration()
      Description copied from interface: Media
      Gets the duration of the media in minutes.
      Specified by:
      getDuration in interface Media
      Returns:
      duration in minutes
    • getFormat

      public String getFormat()
      Description copied from interface: Media
      Gets the file format of the media.
      Specified by:
      getFormat in interface Media
      Returns:
      format string (e.g., "MP3", "MP4", "WAV")
    • getFileSize

      public double getFileSize()
      Description copied from interface: Media
      Gets the file size in megabytes.
      Specified by:
      getFileSize in interface Media
      Returns:
      size in MB
    • isStreamingOnly

      public boolean isStreamingOnly()
      Description copied from interface: Media
      Checks if the media requires an internet connection.
      Specified by:
      isStreamingOnly in interface Media
      Returns:
      true if streaming required, false if downloadable
    • getQuality

      public Media.MediaQuality getQuality()
      Description copied from interface: Media
      Gets the quality setting for the media.
      Specified by:
      getQuality in interface Media
      Returns:
      quality descriptor
    • getDiscountRate

      public double getDiscountRate()
      Description copied from class: Material
      Hook method for discount rate. Default is no discount. Subclasses can override to provide type-specific discounts.
      Overrides:
      getDiscountRate in class Material
      Returns:
      discount rate between 0.0 and 1.0
    • isFeatureLength

      public boolean isFeatureLength()
      Checks if this is a feature-length video.
      Returns:
      true if duration >= 60 minutes
    • getStreamingBandwidth

      public double getStreamingBandwidth()
      Gets bandwidth requirement for streaming in Mbps.
      Returns:
      required bandwidth
    • getCompressedSize

      public double getCompressedSize(double compressionRatio)
      Gets storage space required with compression.
      Parameters:
      compressionRatio - compression ratio (0.5 = 50% compression)
      Returns:
      compressed size in MB
    • getDirector

      public String getDirector()
    • getVideoType

      public VideoMaterial.VideoType getVideoType()
    • getRating

      public String getRating()
    • getCast

      public List<String> getCast()
    • hasSubtitles

      public boolean hasSubtitles()
    • getAspectRatio

      public String getAspectRatio()
    • toString

      public String toString()
      Overrides:
      toString in class Material