-
Notifications
You must be signed in to change notification settings - Fork 0
/
Movie.java
170 lines (144 loc) · 3.93 KB
/
Movie.java
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
package cs249.finalProject;
// Name :Owen Fiber
// Course: CS249
// Date: 04/06/21
// Last Edited: 05/08/21
// Desc: Movie class defines a movie object for use in MovieDBHandler
// Imports ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
import java.io.Serializable;
import java.util.ArrayList;
// Imports ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
public class Movie implements Serializable
{
// Private Data Members ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
private String movieTitle;
private String movieDesc;
private String relDate;
private int movieID;
private Integer voteCount;
private Double voteAvg;
private String posterPath;
private ArrayList<String> castList;
// Private Data Members ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Default constructor
public Movie(){}
// Non-Default constructor
public Movie(String movieTitle, String movieDesc, String relDate, String movieID, String posterPath)
{
this.movieTitle = movieTitle;
this.movieDesc = movieDesc;
this.relDate = relDate;
this.movieID = Integer.parseInt(movieID);
this.posterPath = posterPath;
}
// Non-Default constructor
public Movie(String movieTitle, String movieDesc, String relDate, String movieID, ArrayList<String> castList)
{
this.movieTitle = movieTitle;
this.movieDesc = movieDesc;
this.relDate = relDate;
this.movieID = Integer.parseInt(movieID);
this.castList = castList;
}
// Returns size of current movie's cast list
public int getCastListSize()
{
try
{
try
{
return castList.size();
}catch (IndexOutOfBoundsException ex)
{
return -1;
}
}catch (NullPointerException exception)
{
return -1;
}
}
// Return movie title
public String getMovieTitle()
{
return movieTitle;
}
// Set movie title
public void setMovieTitle(String movieTitle)
{
this.movieTitle = movieTitle;
}
// Return movie description
public String getMovieDesc()
{
return movieDesc;
}
// Set movie description
public void setMovieDesc(String movieDesc)
{
this.movieDesc = movieDesc;
}
// Return movie ID
public int getMovieID()
{
return movieID;
}
// Set movie ID
public void setMovieID(int movieID)
{
this.movieID = movieID;
}
// Return movie release date
public String getRelDate()
{
return relDate;
}
// Set movie release date
public void setRelDate(String relDate)
{
this.relDate = relDate;
}
// Return movie cast list
public ArrayList CastList()
{
return castList;
}
// Set movie cast list
public void setCastList(ArrayList<String> castList)
{
this.castList = castList;
}
// Return movie total vote count
public Integer getVoteCount()
{
return voteCount;
}
// Set movie vote count
public void setVoteCount(Integer voteCount)
{
this.voteCount = voteCount;
}
// Return movie average vote
public Double getVoteAvg()
{
return voteAvg;
}
// Set movie average vote
public void setVoteAvg(Double voteAvg)
{
this.voteAvg = voteAvg;
}
// Return movie poster path
public String getPosterPath()
{
return posterPath;
}
// Set movie poster path
public void setPosterPath(String posterPath)
{
if(posterPath.contains("\""))
{
posterPath = posterPath.replace("\"", "");
}
this.posterPath = posterPath;
}
}