package com.maxiee.heartbeat.model;

import java.util.ArrayList;
import java.util.Collections;

/**
 * Created by maxiee on 15-6-16.
 */
public class Thoughts {

    public static final String THOUGHT = "thought";
    public static final String TIMESTAMP = "timestamp";

    private ArrayList<Thought> mThoughts;

    public Thoughts() {
        mThoughts = new ArrayList<>();
    }

    public void addThought(int key, String thought) {

        Thought thoughtObject = new Thought(
                key,
                thought,
                System.currentTimeMillis());

        mThoughts.add(thoughtObject);
    }

    public ArrayList<Thought> getmThoughts() {
        return mThoughts;
    }

    public Thought get(int position) {
        return mThoughts.get(position);
    }

    public void add(Thought thought) {
        mThoughts.add(thought);
    }

    public void remove(int position) {
        mThoughts.remove(position);
    }

    public void reverse() {
        Collections.reverse(mThoughts);
    }

    public int length() {
        return mThoughts.size();
    }

    public static class Thought {
        public static final String THOUGHT_RES = "thought_res";
        public static final String THOUGHT_PATH = "thought_path";
        public static final int HAS_NO_RES = -1;
        public static final String HAS_NO_PATH = "";
        public static final int RES_IMAGE = 0;

        private int key;
        private String mThought;
        private long mTimeStamp;
        private int mResType = HAS_NO_RES;
        private String mResPath;

        public Thought(int key, String mThought, long mTimeStamp) {
            this.key = key;
            this.mThought = mThought;
            this.mTimeStamp = mTimeStamp;
        }

        public int getKey() {
            return key;
        }

        public String getThought() {
            return mThought;
        }

        public long getTimeStamp() {
            return mTimeStamp;
        }

        public void setThought(String mThought) {
            this.mThought = mThought;
        }

        public void setTypeAndPath(int resType, String path) {
            if (resType == HAS_NO_RES) return;
            mResType = resType;
            mResPath = path;
        }
    }
}

@@ -1560,16 +1560,21 @@
 mResPath
+ = %22%22
 ;%0A%0A     
@@ -2255,16 +2255,193 @@
        %7D
+%0A%0A        public boolean hasImage() %7B return mResType == RES_IMAGE; %7D%0A%0A        public String getPath() %7B return mResPath; %7D%0A%0A        public int getResType() %7B return mResType; %7D
 %0A    %7D%0A%7D

add a few methods.