POM, MovieRecommender#28
Open
betochf wants to merge 3 commits into
Open
Conversation
The file must be in the source project
So it can runs with JDK 8
motenrique
suggested changes
Apr 27, 2021
|
|
||
| public class MovieRecommender { | ||
| String path; | ||
| int repMovies,repUsers; |
There was a problem hiding this comment.
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.
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.
Avoid using implementations, use an interface instead
| } | ||
|
|
||
| public void convert() throws IOException { | ||
| this.user=0; |
There was a problem hiding this comment.
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=""; |
| this.review++; | ||
| } | ||
|
|
||
| if(idProduct != "" && idUser != "" && scoreReview != "") { |
There was a problem hiding this comment.
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.
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")); |
| import java.util.regex.Pattern; | ||
|
|
||
| public class MovieRecommender { | ||
| String path; |
There was a problem hiding this comment.
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.
Where is this function being called?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.