Class VideoMaterial
java.lang.Object
com.university.bookstore.model.Material
com.university.bookstore.model.VideoMaterial
- All Implemented Interfaces:
Media,Comparable<Material>
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.university.bookstore.model.Material
Material.MaterialTypeNested classes/interfaces inherited from interface com.university.bookstore.model.Media
Media.MediaQuality -
Constructor Summary
ConstructorsConstructorDescriptionVideoMaterial(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. -
Method Summary
Modifier and TypeMethodDescriptiongetCast()doublegetCompressedSize(double compressionRatio) Gets storage space required with compression.Abstract method to get the creator/author/artist of the material.doubleHook method for discount rate.Abstract method to get a formatted display string.intGets the duration of the media in minutes.doubleGets the file size in megabytes.Gets the file format of the media.Gets the quality setting for the media.doubleGets bandwidth requirement for streaming in Mbps.booleanbooleanChecks if this is a feature-length video.booleanChecks if the media requires an internet connection.toString()Methods inherited from class com.university.bookstore.model.Material
compareTo, equals, getDiscountedPrice, getId, getPrice, getTitle, getType, getYear, hashCodeMethods inherited from interface com.university.bookstore.model.Media
estimateDownloadTime, getPlaybackInfo
-
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 titledirector- director or producerprice- price in dollarsyear- release yearduration- duration in minutesformat- video format (MP4, AVI, MKV, etc.)fileSize- size in megabytesquality- video qualityvideoType- type of videorating- content rating (G, PG, PG-13, R, etc.)cast- list of main cast memberssubtitlesAvailable- whether subtitles are includedaspectRatio- aspect ratio (16:9, 4:3, etc.)
-
-
Method Details
-
getCreator
Description copied from class:MaterialAbstract method to get the creator/author/artist of the material. Implementation varies by material type.- Specified by:
getCreatorin classMaterial- Returns:
- the creator's name
-
getDisplayInfo
Description copied from class:MaterialAbstract method to get a formatted display string. Each material type should provide its own formatting.- Specified by:
getDisplayInfoin classMaterial- Returns:
- formatted display string
-
getDuration
public int getDuration()Description copied from interface:MediaGets the duration of the media in minutes.- Specified by:
getDurationin interfaceMedia- Returns:
- duration in minutes
-
getFormat
-
getFileSize
public double getFileSize()Description copied from interface:MediaGets the file size in megabytes.- Specified by:
getFileSizein interfaceMedia- Returns:
- size in MB
-
isStreamingOnly
public boolean isStreamingOnly()Description copied from interface:MediaChecks if the media requires an internet connection.- Specified by:
isStreamingOnlyin interfaceMedia- Returns:
- true if streaming required, false if downloadable
-
getQuality
Description copied from interface:MediaGets the quality setting for the media.- Specified by:
getQualityin interfaceMedia- Returns:
- quality descriptor
-
getDiscountRate
public double getDiscountRate()Description copied from class:MaterialHook method for discount rate. Default is no discount. Subclasses can override to provide type-specific discounts.- Overrides:
getDiscountRatein classMaterial- 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
-
getVideoType
-
getRating
-
getCast
-
hasSubtitles
public boolean hasSubtitles() -
getAspectRatio
-
toString
-