/** * @param user @Desc This function populates the "classifiedTimeVector" variable of the * com.post.parser.model.User class. It gives the total number of posts in the specified time * range which has been described in getTimeCategory(int hours) in this class. * @return List<User> */ public User setCategorizedTimeToUser(User user) { ClusterCommons cc = new ClusterCommons(); int[] userTimeVector = user.getClassifiedTimeVector(); for (Posts posts : user.getUserPost()) { Timestamp ts = Timestamp.valueOf( new SimpleDateFormat("yyyy-MM-dd ").format(new Date()).concat(posts.getTime())); int timeCategory = cc.getTimeCategory(ts.getHours()); if (timeCategory < 6) { userTimeVector[timeCategory] = userTimeVector[timeCategory] + 1; } } user.setClassifiedTimeVector(userTimeVector); return user; }