<commit_before>package builders;

import com.mongodb.BasicDBList;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import model.Comment;
import model.Meep;
import org.bson.Document;
import org.bson.types.ObjectId;

import javax.print.Doc;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

/**
 * Created by santiagomarti on 12/14/15.
 */
public class DocumentBuilder {

    public static Document meepDocumentBuilder(Meep arg){
        Document meep = new Document();
        meep.append("senderName", arg.senderName);
        meep.append("senderId", arg.senderId);
        meep.append("message", arg.message);
        meep.append("type", arg.type);
        meep.append("isRoot", arg.isRoot);
        meep.append("picture", arg.picture);
        meep.append("commentCounter", 0);
        meep.append("likeCounter", 0);
        meep.append("viewCounter", 0);

        BasicDBList list = new BasicDBList();
        list.add(arg.longi);
        list.add(arg.lat);
        Document jobj = new Document();
        jobj.append("type", "Point");
        jobj.append("coordinates", list);
        meep.append("location", jobj);

        BasicDBList comments = new BasicDBList();
        meep.append("comments", comments);
        BasicDBList receipts = new BasicDBList();
        meep.append("receipts", receipts);
        BasicDBList registrees = new BasicDBList();
        meep.append("registrees", registrees);
        BasicDBList likes = new BasicDBList();
        meep.append("likes", likes);
        BasicDBList hashtags = new BasicDBList();
        if(arg.hashtags != null)
            for(String s : arg.hashtags)
                hashtags.add(s);
        meep.append("hashtags", hashtags);
        meep.append("isPublic", arg.isPublic);
        return meep;
    }

    public static Document commentDocumentBuilder(Comment arg){
        Document comment = new Document();
        String createdAt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(System.currentTimeMillis()));
        ObjectId newId = new ObjectId();
        comment.append("_id", newId);
        comment.append("senderName", arg.senderName);
        comment.append("senderId", arg.senderId);
        comment.append("message", arg.message);

        BasicDBList hashtags = new BasicDBList();
        if(arg.hashtags != null)
            for(String s : arg.hashtags)
                hashtags.add(s);

        comment.append("hashtags", hashtags);<commit_msg>Doc builder fix<commit_after>package builders;

import com.mongodb.BasicDBList;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import model.Comment;
import model.Meep;
import org.bson.Document;
import org.bson.types.ObjectId;

import javax.print.Doc;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

/**
 * Created by santiagomarti on 12/14/15.
 */
public class DocumentBuilder {

    public static Document meepDocumentBuilder(Meep arg){
        Document meep = new Document();
        meep.append("senderName", arg.senderName);
        meep.append("senderId", arg.senderId);
        meep.append("message", arg.message);
        meep.append("type", arg.type);
        meep.append("isRoot", arg.isRoot);
        meep.append("picture", arg.picture);
        meep.append("commentCounter", 0);
        meep.append("likeCounter", 0);
        meep.append("viewCounter", 0);

        BasicDBList list = new BasicDBList();
        list.add(arg.longi);
        list.add(arg.lat);
        Document jobj = new Document();
        jobj.append("type", "Point");
        jobj.append("coordinates", list);
        meep.append("location", jobj);

        BasicDBList comments = new BasicDBList();
        meep.append("comments", comments);
        BasicDBList receipts = new BasicDBList();
        meep.append("receipts", receipts);
        BasicDBList registrees = new BasicDBList();
        meep.append("registrees", registrees);
        BasicDBList likes = new BasicDBList();
        meep.append("likes", likes);
        BasicDBList hashtags = new BasicDBList();
        if(arg.hashtags != null)
            for(String s : arg.hashtags)
                hashtags.add(s);
        meep.append("hashtags", hashtags);
        meep.append("isPublic", arg.isPublic);
        return meep;
    }

    public static Document commentDocumentBuilder(Comment arg){
        Document comment = new Document();
        String createdAt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(System.currentTimeMillis()));
        ObjectId newId = new ObjectId();
        comment.append("_id", newId);
        comment.append("senderName", arg.senderName);
        comment.append("senderId", arg.senderId);
        comment.append("message", arg.message);
        comment.append("type", arg.type);

        BasicDBList hashtags = new BasicDBList();
        if(arg.hashtags != null)
            for(String s : arg.hashtags)
                hashtags.add(s);

        comment.append("hashtags", hashtags);
{'fraction_non_alphanumeric': 0.1310641627543036, 'fraction_numerical': 0.0035211267605633804, 'mean_word_length': 2.8647014361300074, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '814261', 'n_tokens_mistral': 1559, 'n_tokens_neox': 1498, 'n_words': 319}