Class User


public class User extends Object
  • Field Details

  • Constructor Details

    • User

      public User(String name, double dist, Achievement ach, Calendar cal)
      Constructor of the User object; creates a new user object, and adds it to the list of all users
      Parameters:
      name - name of the user
      dist - distance ran by the user
      ach - achievement progress? by the user
      cal - Calendar for the specific user
  • Method Details

    • displayFriendStats

      public void displayFriendStats(User u)
      Prints statistics of user's friends in the console; specifically printing the total distance ran and achievement progression
      Parameters:
      u - User to see the statistics of
    • addFriend

      public void addFriend(User u)
      Adds a user to this user's friends list
      Parameters:
      u - User object to be added to the myFriends list
    • myTotalDistance

      public double myTotalDistance()
      calculate the total user specific distance
      Returns:
      the total distance ran over all runs
    • addRun

      public void addRun(Run r)
      Adds a run to all of user's runs
      Parameters:
      r - The run to be added to the user's collection of runs
    • addNewJournalEntry

      public void addNewJournalEntry(LocalDateTime days, String s)
      Adds a new journal entry
      Parameters:
      days - days to be added to journal entry
      s - Notes/feedback for the specific day(s)
    • getMyRuns

      public ArrayList<Run> getMyRuns()
      Gets number of runs
      Returns:
      number of total runs
    • getMyUserName

      public String getMyUserName()
      Gets the name of the user
      Returns:
      user name
    • setMyUserName

      public void setMyUserName(String myUserName)
      Sets this user's name
      Parameters:
      myUserName - new username to be changed to
    • getMyTotalDistance

      public double getMyTotalDistance()
      Gets total distance ran
      Returns:
      total distance across all runs
    • setMyTotalDistance

      public void setMyTotalDistance(double myTotalDistance)
      Sets total distance ran
      Parameters:
      myTotalDistance - total distance ran by this user becomes this var
    • getMyFriends

      public ArrayList<User> getMyFriends()
      Gets list of all friends
      Returns:
      arraylist of all user's friends
    • getJournal

      public HashMap<LocalDateTime,​String> getJournal()
      Gets a hashmap of all notes in coordinance with all dates in the journal
      Returns:
      the journal entries
    • getCalendar

      public Calendar getCalendar()
      Gets the user's calendar
      Returns:
      the calendar of the user
    • getAchievement

      public Achievement getAchievement()
      Gets achievement progress of the user
      Returns:
      Progression of achievements by this user
    • setAchievement

      public void setAchievement(Achievement ach)
      Sets achievement progress of this user
      Parameters:
      ach - achievement progress to be set to