package com.averi.worldscribe;

import java.util.HashSet;

/**
 * <p>
 * Created by mark on 31/07/16.
 * </p>
 *
 * <p>
 * Contains a list of all of the Articles that are linked to a certain Article through one
 * of the three types of links (Connection, Membership, or Residence).
 * </p>
 */
public class LinkedArticleList {

    private HashSet<String> personNames;
    private HashSet<String> groupNames;
    private HashSet<String> placeNames;
    private HashSet<String> itemNames;
    private HashSet<String> conceptNames;

    /**
     * Adds an Article to this list.
     * @param category The {@link Category} of the Article.
     * @param name The name of the Article.
     */
    public void addArticle(Category category, String name) {
        switch (category) {
            case Person:
                personNames.add(name);
                break;
            case Group:
                groupNames.add(name);
                break;
            case Place:
                placeNames.add(name);
                break;
            case Item:
                itemNames.add(name);
                break;
            case Concept:
            default:
                conceptNames.add(name);
                break;
        }
    }

    /**
     * Gets all Article links within a certain Category.
     * @param category The {@link Category} of Articles to return.
     * @return A HashSet containing all Article links of the specified Category.
     */
    public HashSet<String> getAllLinksInCategory(Category category) {
        switch (category) {
            case Person:
                return personNames;
            case Group:
                return groupNames;
            case Place:
                return placeNames;
            case Item:
                return itemNames;
            case Concept:
            default:
                return conceptNames;
        }
    }

}

@@ -25,16 +25,45 @@
 cribe;%0A%0A
+import java.io.Serializable;%0A
 import j
@@ -347,16 +347,40 @@
 cleList 
+implements Serializable 
 %7B%0A%0A    p

Make LinkedArticleList serializable