package edu.northwestern.bioinformatics.studycalendar.domain.tools;

import java.util.*;

/**
 * @author Jalpa Patel
 */
public class Differences {
    private List<String> messages = new ArrayList<String>();
    private Map<String, Differences> childDifferences = new HashMap<String, Differences>();

    public void addChildDifferences(String prefix, Differences differences) {
        childDifferences.put(prefix, differences);
    }

    public void addMessage(String message) {
        getMessages().add(message);
    }

    public boolean hasDifferences(){
        if (!getMessages().isEmpty() || !getChildDifferences().isEmpty()) {
            return true;
        }
        return false;
    }

    public List<String> getMessages() {
        return messages;
    }

    public void setMessages(List<String> messages) {
        this.messages = messages;
    }

    public Map<String, Differences> getChildDifferences() {
        return childDifferences;
    }

    public void setChildDifferences(Map<String, Differences> childDifferences) {
        this.childDifferences = childDifferences;
    }

}

@@ -1100,10 +1100,684 @@
 %0A    %7D%0A%0A
+    @Override%0A    public String toString() %7B%0A        StringBuilder sb = new StringBuilder();%0A        if (!getMessages().isEmpty()) %7B%0A            for (Iterator%3CString%3E it = getMessages().iterator(); it.hasNext();) %7B%0A                sb.append(it.next()).append(%22;%22);%0A            %7D%0A        %7D%0A        if (!getChildDifferences().isEmpty()) %7B%0A            for (Iterator entries = getChildDifferences().entrySet().iterator(); entries.hasNext();) %7B%0A                Map.Entry entry = (Map.Entry)entries.next();%0A                sb.append(entry.getKey()).append(%22 %22);%0A                sb.append((entry.getValue()).toString());%0A            %7D%0A        %7D%0A        return sb.toString();%0A    %7D%0A
 %7D%0A

Add toString() method to Differences Class. #647.