-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVideo.java
More file actions
79 lines (71 loc) · 2.62 KB
/
Video.java
File metadata and controls
79 lines (71 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/** A video file object that extends the Media class
* Adds on the length and resolution of the video
* @author aydin-ali kachra
* @version 1
*/
public class Video extends Media {
//instance variables
private int videoLength; //measured in seconds
private String videoResolution;
/** Creates a new Video object
* @param fileName - name of the video file
* @param fileType - type of video file
* @param fileSize - size of the video file in MB
* @param videoLength - the length of the video in seconds
* @param videoResolution - the resolution of the video
*/
public Video(String fileName, String fileType, double fileSize, int videoLength, String videoResolution) {
super(fileName, fileType, fileSize);
this.videoLength = videoLength;
this.videoResolution = videoResolution;
}
/** Returns the length of the video
* @return the video length
*/
public int getVideoLength() {
return this.videoLength;
}
/** Returns the resolution of the video
* @return the video resolution
*/
public String getVideoResolution() {
return this.videoResolution;
}
/** Returns which application launches when you open a video file
* Completes abstract method from Media class
* @return the application that launches when the video file opens
*/
public String openFile() {
return "Launching QuickTime Player...";
}
/** Finds if the Video object is equal another object
* Overrides equals() in Media class
* @param other - object which you are comparing the Video file to
* @return whether the two objects are equal or not
*/
public boolean equals(Object other) {
//checks if the super class is equal, otherwise there's no point on checking the rest
if (super.equals(other)) {
if (other == null) {
return false;
}
if (!(other instanceof Video)) {
return false;
}
Video toCompare = (Video) other;
if (this.videoLength == toCompare.videoLength &&
this.videoResolution.equals(toCompare.videoResolution)) {
return true;
}
return false;
}
return false;
}
/** Creates and returns a string rep of the Video object
* Overrides toString() in Media class
* @return the string rep of the Video object
*/
public String toString() {
return "Media Type: video, " + super.toString() + ", Video Length: " + this.videoLength + "s, Video Resolution: " + videoResolution;
}
}