예제 #1
0
  /**
   * @param user
   * @return 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.
   */
  public User setCategorizedHourOfDayToUser(User user) {
    int[] userTimeVector = user.getClassifiedHourOfDayVector();
    for (Posts posts : user.getUserPost()) {
      Timestamp ts =
          Timestamp.valueOf(
              new SimpleDateFormat("yyyy-MM-dd ").format(new Date()).concat(posts.getTime()));
      int timeCategory = ts.getHours();
      userTimeVector[timeCategory] = userTimeVector[timeCategory] + 1;
    }
    user.setClassifiedHourOfDayVector(userTimeVector);

    return user;
  }
예제 #2
0
  /**
   * @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;
  }