Android Open Source - Team7-301Project Entry






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.models;
/* www  .j  av a  2 s  .  com*/
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import android.graphics.Bitmap;
import android.graphics.Picture;

/**
 * Super class of Question and Answer. This defines the generic contents of an entry
 * on the forum. This includes up vote, author, replies, date, pictures, the post etc.
 * A model class with get and set methods.
 * 
 */
public class Entry
{
  private int upVote;
  private String post;
  private String posterName;
  private ArrayList<Reply> replies;
  private Date date;
  private String picture = null;

  /**
   * Creates a new Entry.
   * 
   * @param post_
   *            The post (main body of text) of the Entry.
   * @param author_
   *            The person who wrote the Entry.
   */
  public Entry(String post_, String author_)
  {
    this.post = post_;
    this.posterName = author_;
    this.upVote = 0;
    this.replies = new ArrayList<Reply>();
    this.date = new Date();
  }

  /**
   * Returns the main body of text for this entry (the post).
   * @return The main body of text.
   */
  public String toString()
  {
    return this.post;
  }
  
  /**
   * Get all the replies to this Entry.
   * 
   * @return ArrayList<Reply>
   */
  public List<Reply> getReplies()
  {
    return replies;
  }
/**
 * use an array list to set the replies 
 * @param replies_
 */
  public void setReplies(ArrayList<Reply> replies_){
    replies=replies_;
  }
  /**
   * Add a Reply to this Entry.
   * 
   * @param reply
   *            The Reply to add.
   */
  public void addReplies(Reply reply)
  {
    replies.add(reply);
  }

  /**
   * Get how many up votes this Entry has.
   * 
   * @return int
   */
  public int getUpVote()
  {
    return upVote;
  }

  /**
   * Set how many up votes this Entry has.
   * 
   * @param upVote_
   *            How many up votes this entry has.
   */
  public void setUpVote(int upVote_)
  {
    upVote = upVote_;
  }

  /**
   * Get the post (main body of text) for this Entry.
   * 
   * @return String
   */
  public String getPost()
  {
    return post;
  }

  /**
   * Set the post (main body of text) for this Entry.
   * 
   * @param s
   *            The post (main body of text) for this Entry.
   */
  public void setPost(String s)
  {
    post = s;
  }

  /**
   * Get the name of the person who created this Entry.
   * 
   * @return String
   */
  public String getAuthorsName()
  {
    return posterName;
  }

  /**
   * Set the name of the person who created this Entry.
   * 
   * @param name
   *            The person who created this Entry.
   */
  public void setAuthorName(String name)
  {
    posterName = name;
  }

  /**
   * Get the date this Entry was made
   * 
   * @return Java Date object.
   */
  public Date getDate()
  {
    return date;
  }

  /**
   * Set the picture attached to this Entry. No, it cannot have two picture.
   * Don't be stupid.
   * 
   * @param bigPictureFile
   *            The picture.
   */
  public void setPicture(String bigPictureFile)
  {
    picture = bigPictureFile;
  }

  /**
   * Returns the picture attached to this Entry.
   * 
   * @return Picture
   */
  public String getPicture()
  {
    return picture;
  }
}




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