-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
POM, MovieRecommender #28
base: main
Are you sure you want to change the base?
Conversation
The file must be in the source project
So it can runs with JDK 8
|
||
public class MovieRecommender { | ||
String path; | ||
int repMovies,repUsers; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Declaration should go on single line
public class MovieRecommender { | ||
String path; | ||
int repMovies,repUsers; | ||
int user,product,review; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, declaration should go on single lines
String path; | ||
int repMovies,repUsers; | ||
int user,product,review; | ||
HashMap<String, Integer> userId = new HashMap<String, Integer>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid using implementations, use an interface instead
} | ||
|
||
public void convert() throws IOException { | ||
this.user=0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initialization should be part of constructor. Also, default values of int attributes is zero
this.review=0; | ||
this.repMovies=0; | ||
this.repUsers=0; | ||
String idUser="",idProduct="", scoreReview=""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Declaration should be single line
this.review++; | ||
} | ||
|
||
if(idProduct != "" && idUser != "" && scoreReview != "") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use equals
method to compare Objects
|
||
if(idProduct != "" && idUser != "" && scoreReview != "") { | ||
csvWriter.append(userId.get(idUser).toString()); | ||
csvWriter.append(","); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid using string literals, you can use a static String or an enum
public int getTotalUsers(){ return this.user; } | ||
|
||
public List <String> getRecommendationsForUser(String id) throws IOException, TasteException { | ||
DataModel model = new FileDataModel(new File("list.csv")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid hardcoding file names
import java.util.regex.Pattern; | ||
|
||
public class MovieRecommender { | ||
String path; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Define right access modifier for class attributes
public int getTotalProducts(){ return this.product; } | ||
public int getTotalUsers(){ return this.user; } | ||
|
||
public List <String> getRecommendationsForUser(String id) throws IOException, TasteException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this function being called?
No description provided.