From fd55ff9147cca93487b0feb448a3f1ffa44ab1d3 Mon Sep 17 00:00:00 2001 From: Sofia Yfantidou Date: Sun, 18 Sep 2016 16:02:06 +0300 Subject: [PATCH] Adds forgotten Javadoc --- src/mongo/MongoConnector.java | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/mongo/MongoConnector.java b/src/mongo/MongoConnector.java index 5523348..498256f 100644 --- a/src/mongo/MongoConnector.java +++ b/src/mongo/MongoConnector.java @@ -25,11 +25,12 @@ public class MongoConnector { // Fields for twitter DB private static final String _TWEET_JSON_ = "tweet"; private static final String _TWEET_PARSED_STRING_ = "parsedString"; - private static final String _TWEET_EMOTION_SCORES_ = "emScores"; + // Fields for youtube DB private static final String _COMMENT_JSON_ = "comment"; private static final String _COMMENT_PARSED_STRING_ = "parsedString"; - private static final String _COMMENT_EMOTION_SCORES_ = "emScores"; + + private static final String EMOTION_SCORES_ = "emScores"; private static final String _COLL_INDEX_ = "_id"; @@ -158,23 +159,36 @@ public HashMap getParsedTweets() { return getParsed(parsedTweetsCollection, _TWEET_PARSED_STRING_); } + /** + * Insert emotions to Twitter database + * @param UUID The Id of the tweet that we want to insert the emotions to. + * @param emotions an array list of pair(string, double) where the string is the name of the emotion and + * the double is the value of that emotion + * @return True if the insertion was done correctly, false otherwise + */ public boolean insertEmotionsTwitter(ObjectId UUID, List> emotions) { MongoCollection tweets = _db.getCollection(_coll_name_twitter); return insertEmotions(UUID, emotions, tweets); } + /** + * Insert emotions to YouTube database + * @param UUID The Id of the comment that we want to insert the emotions to. + * @param emotions an array list of pair(string, double) where the string is the name of the emotion and + * the double is the value of that emotion + * @return True if the insertion was done correctly, false otherwise + */ public boolean insertEmotionsYoutube(ObjectId UUID, List> emotions) { MongoCollection comments = _db_youtube.getCollection(_coll_name_youtube); return insertEmotions(UUID, emotions, comments); } /** - * Takes a tweet id and inserts emotions with their values - * @param UUID The Id of the tweet that we want to insert the emotions to. - * Pair (Document's Unique number, the trend name of the tweet) + * Takes a tweet or comment id and inserts emotions with their values + * @param UUID The Id of the tweet/comment that we want to insert the emotions to. * @param emotions an array list of pair(string, double) where the string is the name of the emotion and * the double is the value of that emotion - * @return if the document + * @return True if the insertion was done correctly, false otherwise */ private boolean insertEmotions(ObjectId UUID, List> emotions, MongoCollection col) { FindIterable iterable = col.find(new Document(_COLL_INDEX_, UUID)); @@ -188,7 +202,7 @@ private boolean insertEmotions(ObjectId UUID, List