package com.google.sps;

import com.google.common.collect.ImmutableList;
import java.io.IOException;
import java.util.Random;

/**Represents a Video that's been analyzed by the NLP API */
public class AnalyzedVideo {
  public final static ImmutableList<String> titlesList =
      ImmutableList.of("Where is this supposed to go?", "This program needs to work better",
          "The wifi needs to be more consistent", "This could be better",
          "Maybe this could be structured a different way");
  public final static ImmutableList<Double> sentimentList =
      ImmutableList.of(-.3, -.5, -.1, -.2, -.5);
  public final static ImmutableList<Integer> upvotesList = ImmutableList.of(30, 50, 10, 5, 12);
  public final static ImmutableList<String> urlList =
      ImmutableList.of("http://www.youtube.com", "http://www.reddit.com", "http://www.facebook.com",
          "http://www.yahoo.com", "http://www.amazon.com");
  private final static Random rand = new Random();
  private final String threadTitle;
  private final double sentiment;
  private final int upvotes;
  private final int timestamp;
  private final String threadUrl;

  private AnalyzedVideo(
      String threadTitle, double sentiment, int upvotes, int timestamp, String threadUrl) {
    this.threadTitle = threadTitle;
    this.sentiment = sentiment;
    this.upvotes = upvotes;
    this.timestamp = timestamp;
    this.threadUrl = threadUrl;
  }

  public static AnalyzedVideo createThread(
      String threadTitle, double sentiment, int upvotes, int timestamp, String threadUrl) {
    return new AnalyzedVideo(threadTitle, sentiment, upvotes, timestamp, threadUrl);
  }

  public String title() {
    return threadTitle;
  }

  public double sentiment() {
    return sentiment;
  }

  public int upvote() {
    return upvotes;
  }

  public int timeStamp() {
    return timestamp;
  }

  public String url() {
    return threadUrl;
  }

  public static String getRandomTitle() {
    String randomTitle = titlesList.get(rand.nextInt(4));
    return randomTitle;
  }

  public static double getRandomSentiment() {
    double randomSentiment = sentimentList.get(rand.nextInt(4));
    return randomSentiment;
  }

  public static int getRandomUpvote() {
    int randomUpvote = upvotesList.get(rand.nextInt(4));
    return randomUpvote;
  }

  public static String getRandomUrl() {
    String randomUrl = urlList.get(rand.nextInt(4));
    return randomUrl;
  }

  public String toString() {
    return String.format("thread: %s, sentiment: %d, upvote: %d, timestamp: %d, url: %s",
        threadTitle, sentiment, upvotes, timestamp, threadUrl);
  }
}

@@ -1955,28 +1955,14 @@
     
-String randomTitle =
+return
  tit
@@ -1995,32 +1995,8 @@
 ));%0A
-    return randomTitle;%0A
   %7D%0A
@@ -2050,32 +2050,14 @@
     
-double randomSentiment =
+return
  sen
@@ -2093,36 +2093,8 @@
 ));%0A
-    return randomSentiment;%0A
   %7D%0A
@@ -2142,26 +2142,14 @@
     
-int randomUpvote =
+return
  upv
@@ -2183,33 +2183,8 @@
 ));%0A
-    return randomUpvote;%0A
   %7D%0A
@@ -2232,26 +2232,14 @@
     
-String randomUrl =
+return
  url
@@ -2273,25 +2273,8 @@
     
-return randomUrl;
 %0A  %7D

Update AnalyzedVideo.java