Class TempAnswer

java.lang.Object
com.ubs.backend.classes.TempAnswer

public class TempAnswer extends Object
Class for saving a temporary answer with all tags. used for building JSON objects
Since:
17.07.2021
Author:
Tim Irmler
  • Field Details

    • answer

      private Answer answer
      The answer
      Since:
      17.07.2021
      See Also:
      Answer
    • tags

      private ArrayList<TempTag> tags
      all the tags this answer has
      Since:
      17.07.2021
      See Also:
      TempTag
    • mySingleResultTagID

      private long mySingleResultTagID
      one single tag, used to count how many answers are using this tag
      Since:
      17.07.2021
      See Also:
      TempTag
    • usefulness

      private float usefulness
      the usefulness of this answer, calculated by the average usefulness of all its tags
      Since:
      21.07.2021
    • upvotes

      private int upvotes
      used for tag detail site, if we want to display the amount of upvotes the single tag has on this single answer
    • downvotes

      private int downvotes
      used for tag detail site, if we want to display the amount of downvotes the single tag has on this single answer
  • Constructor Details

    • TempAnswer

      public TempAnswer(Answer answer, ArrayList<TempTag> tags)
      Parameters:
      answer -
      tags -
      Since:
      17.07.2021
    • TempAnswer

      public TempAnswer(Answer answer, long mySingleResultTagID)
      Parameters:
      answer -
      mySingleResultTagID -
      Since:
      17.07.2021
    • TempAnswer

      public TempAnswer(Answer answer)
      Parameters:
      answer -
      Since:
      17.07.2021
    • TempAnswer

      public TempAnswer(Answer answer, ArrayList<TempTag> tags, int usefulness)
      Parameters:
      tags -
      usefulness -
      Since:
      21.07.2021
    • TempAnswer

      public TempAnswer(Answer answer, long mySingleResultTagID, int usefulness)
      Parameters:
      answer -
      mySingleResultTagID -
      usefulness -
      Since:
      21.07.2021
  • Method Details

    • getAnswer

      public Answer getAnswer()
      Returns:
      Since:
      17.07.2021
    • setAnswer

      public void setAnswer(Answer answer)
      Parameters:
      answer -
      Since:
      17.07.2021
    • getTags

      public ArrayList<TempTag> getTags()
      Returns:
      Since:
      17.07.2021
    • setTags

      public void setTags(ArrayList<TempTag> tags)
      Parameters:
      tags - the new List of Tags
      Since:
      17.07.2021
    • addTag

      public boolean addTag(TempTag tag)
      Method to add a Tag
      Parameters:
      tag - the new Tag
      Returns:
      if the Tag was added
      Since:
      17.07.2021
    • removeTag

      public boolean removeTag(TempTag tag)
      Method to remove a Tag
      Parameters:
      tag - the Tag being removed
      Returns:
      if the Tag was removed
      Since:
      17.07.2021
    • getMySingleResultTagID

      public long getMySingleResultTagID()
      Returns:
      the ID of the single Tag
      Since:
      17.07.2021
    • setMySingleResultTagID

      public void setMySingleResultTagID(long mySingleResultTagID)
      Parameters:
      mySingleResultTagID - the ID of the new single Tag
      Since:
      17.07.2021
    • getUsefulness

      public float getUsefulness()
    • setUsefulness

      public void setUsefulness(float usefulness)
    • getUpvotes

      public int getUpvotes()
    • setUpvotes

      public void setUpvotes(int upvotes)
    • increaseUpvotes

      public void increaseUpvotes(int value)
    • getDownvotes

      public int getDownvotes()
    • setDownvotes

      public void setDownvotes(int downvotes)
    • increaseDownvotes

      public void increaseDownvotes(int value)
    • toString

      public String toString()
      Overrides:
      toString in class Object