Android Open Source - Team7-301Project Post






From Project

Back to project page Team7-301Project.

License

The source code is released under:

Apache License

If you think the Android project Team7-301Project listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package ca.ualberta.cs.f14t07_application;
/*from  ww w  .  j a  v a2s. c  o  m*/
import java.util.ArrayList;

import ca.ualberta.cs.models.Reply;

/**
 * Describes what a forum post's main question or answer to main question contains.
 * @author Brendan
 * 
 */
public class Post
{
  private int upVote, downVote;
  private String post, postersName;
  private ArrayList<Reply> replies;

  /**
   * Instantiate a forum post's main question or answer 
   * @param post      The text that the main question or answer contains.
   * @param postersName  The name of the person who posted to the main question or answer.
   */
  public Post(String post, String postersName)
  {
    super();
    this.upVote = 0;
    this.downVote = 0;
    this.post = post;
    this.postersName = postersName;
    this.replies = new ArrayList<Reply>();
  }

  /**
   * Retrieve a specific reply to a main question or answer.
   * @param id  The position of the reply. For example, if there are 4 replies to a main 
   *         question or answer then an argument of 0 returns the first reply, an
   *         argument of 1 returns the second reply,... 
   * @return    A Reply object which contains the reply.
   */
  public Reply getReplySpecific(int id)
  {
    return this.replies.get(id);
  }
  
  /**
   * Add a reply to the main question or answer.
   * @param reply  The Reply object that contains the reply.
   */
  public void addReply(Reply reply)
  {
    this.replies.add(reply);
  }
  
  /**
   * Retrieve all replies to a main question or answer.
   * @return  All replies to a main question or answer in the form of an ArrayList<Reply>.
   */
  public ArrayList<Reply> getReplies()
  {
    return replies;
  }

  /**
   * How many times the main question or answer has been up voted.
   * @return How many times the main question or answer has been up voted.
   */
  public int getUpVote()
  {
    return upVote;
  }

  /**
   * Specify the exact number of people who have up voted the main question or answer.
   * @param upVote How many up votes the main question or answer has.
   */
  public void setUpVote(int upVote)
  {
    this.upVote = upVote;
  }

  /**
   * How many times the main question or answer has been down voted.
   * @return How many times the main question or answer has been down voted.
   */
  public int getDownVote()
  {
    return downVote;
  }

  /**
   * Specify the exact number of people who have down voted the main question or answer.
   * @param downVote How many down votes the main question or answer has.
   */
  public void setDownVote(int downVote)
  {
    this.downVote = downVote;
  }

  /**
   * The main question or answer's text.
   * @return The text of the main question or answer.
   */
  public String getPost()
  {
    return post;
  }

  /**
   * Specify the text of the main question or answer.
   * @param post The text of the main question or answer.
   */
  public void setPost(String post)
  {
    this.post = post;
  }

  /**
   * Get the text of the poster's name.
   * @return The text of the poster's name.
   */
  public String getPostersName()
  {
    return postersName;
  }

  /**
   * Specify the text of the poster's name.
   * @param postersName The text of the poster's name.
   */
  public void setPostersName(String postersName)
  {
    this.postersName = postersName;
  }

}




Java Source Code List

ca.ualberta.cs.controllers.AuthorController.java
ca.ualberta.cs.controllers.BrowseController.java
ca.ualberta.cs.controllers.ForumEntryController.java
ca.ualberta.cs.controllers.SearchController.java
ca.ualberta.cs.f14t07_application.Hits.java
ca.ualberta.cs.f14t07_application.LogoActivity.java
ca.ualberta.cs.f14t07_application.Post.java
ca.ualberta.cs.intent_singletons.BrowseRequestSingleton.java
ca.ualberta.cs.intent_singletons.ContextSingleton.java
ca.ualberta.cs.intent_singletons.EntrySingleton.java
ca.ualberta.cs.intent_singletons.ForumEntrySingleton.java
ca.ualberta.cs.models.Answer.java
ca.ualberta.cs.models.AuthorModel.java
ca.ualberta.cs.models.DataManager.java
ca.ualberta.cs.models.Entry.java
ca.ualberta.cs.models.ForumEntryList.java
ca.ualberta.cs.models.ForumEntry.java
ca.ualberta.cs.models.JsonDriver.java
ca.ualberta.cs.models.Observable.java
ca.ualberta.cs.models.Question.java
ca.ualberta.cs.models.Reply.java
ca.ualberta.cs.remote_server.NetworkChecker.java
ca.ualberta.cs.remote_server.SearchHit.java
ca.ualberta.cs.remote_server.SearchResponse.java
ca.ualberta.cs.remote_server.SimpleSearchCommand.java
ca.ualberta.cs.views.AnswerActivity.java
ca.ualberta.cs.views.AnswerListAdapter.java
ca.ualberta.cs.views.AskActivity.java
ca.ualberta.cs.views.BrowseActivity.java
ca.ualberta.cs.views.HelpActivity.java
ca.ualberta.cs.views.MainScreenActivity.java
ca.ualberta.cs.views.Observer.java
ca.ualberta.cs.views.QuestionActivity.java
ca.ualberta.cs.views.ReplyListAdapter.java