<commit_before>package edu.cmu.chimps.messageontap_api;

import android.util.SparseArray;

import java.util.ArrayList;

/**
 * Created by mars on 29/07/2017.
 */

public class ParseTree {

    private static final int FLAG_NORMAL = 0;
    private static final int FLAG_DELETE = 1;
    private static final int FLAG_MERGE = 2;

    public class Node {

        private int mId;
        private String mType;
        private String mWord;
        private String mEntity;
        private ArrayList<Integer> mChildrenIds;
        private int mParentId;
        private String mRelation;
        private int mFlag; // 0 = normal, 1 = delete, 2 = merge
        private ArrayList<Tag> mTagList;

        public Node() {
            this.mChildrenIds = new ArrayList<>();
            this.mFlag = FLAG_DELETE;
        }

        public void setValue(String type, String word) {
            this.mType = type;
            this.mWord = word;
            //this.entity = null;
            //this.parentId = null;
            //this.childrenIds = new ArrayList<>();
            this.mFlag = FLAG_NORMAL;
        }

        public void setId(int id) {
            this.mId = id;
        }

        public int getId() {
            return this.mId;
        }

        public String getType() {
            return mType;
        }

        public void setType(String type) {
            this.mType = type;
        }

        public String getWord() {
            return mWord;
        }

        public void setWord(String word) {
            this.mWord = word;
        }

        public String getEntity() {
            return mEntity;
        }

        public void setEntity(String entity) {
            this.mEntity = entity;
        }

        public ArrayList<Integer> getChildrenIds() {
            return mChildrenIds;
        }

        public void addChildrenId(int id) {
            mChildrenIds.add(id);
        }

        public void setChildrenIds(ArrayList<Integer> childrenIds) {
            this.mChildrenIds = childrenIds;
        }

        public int getParentId() {
            return mParentId;
        }

        public void setParentId(int parentId) {
            this.mParentId = parentId;
        }

        public String getRelation() {
            return mRelation;
        }

        public void setRelation(String relation) {
            this.mRelation = relation;
        }

        public int getFlag() {
            return mFlag;
        }

        public void setFlag(int flag) {
            this.mFlag = flag;
        }

        public ArrayList<Tag> getTagList() {
            return mTagList;
        }

        public void setTagList(ArrayList<Tag> tagList) {
            this.mTagList = tagList;
        }

        public void addTag(Tag t) {
            ArrayList<Tag> tagList = this.getTagList();
            tagList.add(t);
            this.setTagList(tagList);
        }

        @Override
        public String toString() {
            return this.print("");
        }

        private String print(String indent) {
            /*<commit_msg>ParseTree flag enum<commit_after>package edu.cmu.chimps.messageontap_api;

import android.util.SparseArray;

import java.util.ArrayList;

public class ParseTree {

    enum Flag{NORMAL, DELETE, MERGE}

    public class Node {

        private int mId;
        private String mType;
        private String mWord;
        private String mEntity;
        private ArrayList<Integer> mChildrenIds;
        private int mParentId;
        private String mRelation;
        private Flag mFlag;
        private ArrayList<Tag> mTagList;

        public Node() {
            this.mChildrenIds = new ArrayList<>();
            this.mFlag = Flag.DELETE;
        }

        public void setValue(String type, String word) {
            this.mType = type;
            this.mWord = word;
            //this.entity = null;
            //this.parentId = null;
            //this.childrenIds = new ArrayList<>();
            this.mFlag = Flag.NORMAL;
        }

        public void setId(int id) {
            this.mId = id;
        }

        public int getId() {
            return this.mId;
        }

        public String getType() {
            return mType;
        }

        public void setType(String type) {
            this.mType = type;
        }

        public String getWord() {
            return mWord;
        }

        public void setWord(String word) {
            this.mWord = word;
        }

        public String getEntity() {
            return mEntity;
        }

        public void setEntity(String entity) {
            this.mEntity = entity;
        }

        public ArrayList<Integer> getChildrenIds() {
            return mChildrenIds;
        }

        public void addChildrenId(int id) {
            mChildrenIds.add(id);
        }

        public void setChildrenIds(ArrayList<Integer> childrenIds) {
            this.mChildrenIds = childrenIds;
        }

        public int getParentId() {
            return mParentId;
        }

        public void setParentId(int parentId) {
            this.mParentId = parentId;
        }

        public String getRelation() {
            return mRelation;
        }

        public void setRelation(String relation) {
            this.mRelation = relation;
        }

        public Flag getFlag() {
            return mFlag;
        }

        public void setFlag(Flag flag) {
            this.mFlag = flag;
        }

        public ArrayList<Tag> getTagList() {
            return mTagList;
        }

        public void setTagList(ArrayList<Tag> tagList) {
            this.mTagList = tagList;
        }

        public void addTag(Tag t) {
            ArrayList<Tag> tagList = this.getTagList();
            tagList.add(t);
            this.setTagList(tagList);
        }

        @Override
        public String toString() {
            return this.print("");
        }

        private String print(String indent) {
            /*
{'fraction_non_alphanumeric': 0.08340311505610451, 'fraction_numerical': 0.0023446658851113715, 'mean_word_length': 1.4821280133000831, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '4769896', 'n_tokens_mistral': 1640, 'n_tokens_neox': 1572, 'n_words': 411}