package com.grayben.riskExtractor.headingMarker.elector;

import com.grayben.riskExtractor.headingMarker.nominator.NominatedText;
import org.apache.commons.collections4.list.SetUniqueList;

import java.util.ArrayList;
import java.util.List;

public class ElectedText

        extends
        NominatedText

        implements
	    ElecteesRetrievable {

    SetUniqueList<Integer> electees;

    public ElectedText(List<String> textList, SetUniqueList<Integer> nominees, SetUniqueList<Integer> electees){
        super(textList, nominees);
        if (electees == null) {
            throw new NullPointerException("Attempted to pass illegal null argument");
        }
        if ( ! nominees.containsAll(electees))
            throw new IllegalArgumentException(
                    "The electees argument was not a subset " +
                            "of the nominees argument"
            );
        this.electees = electees;
    }

    public ElectedText(NominatedText nominatedText, SetUniqueList<Integer> electees){
        this(
                nominatedText.getStringList(),
                nominatedText.getNominees(),
                electees
        );
    }

    public ElectedText(ElectedText electedText){
        this(electedText, electedText.getElectees());
    }

    @Override
    public SetUniqueList<Integer> getElectees() {

        SetUniqueList<Integer> newSetUniqueList
                = SetUniqueList.setUniqueList(new ArrayList<>());

        newSetUniqueList.addAll(this.electees);

        return newSetUniqueList;
    }

}

@@ -235,16 +235,78 @@
 .List;%0A%0A
+/**%0A * NominatedText which has also had nominees elected.%0A */%0A
 public c
@@ -314,33 +314,32 @@
 ass ElectedText%0A
-%0A
         extends%0A
@@ -360,17 +360,16 @@
 tedText%0A
-%0A
         
@@ -415,41 +415,496 @@
     
-SetUniqueList%3CInteger%3E electees;%0A
+/**%0A     * The list of indices to the list of Strings corresponding to electees.%0A     */%0A    SetUniqueList%3CInteger%3E electees;%0A%0A    /**%0A     * Constructs ElectedText 'from scratch'.%0A     * %3Cp%3E%0A     * @param textList the list of Strings corresponding to the text%0A     * @param nominees the indices into textList corresponding to nominated entries%0A     * @param electees the indices into textList corresponding to elected entries%0A     * @apiNote electees must be a subset of nominees%0A     */
 %0A   
@@ -1439,32 +1439,295 @@
 lectees;%0A    %7D%0A%0A
+    /**%0A     * Construct ElectedText incrementally from an existing %7B@link NominatedText%7D%0A     * @param nominatedText the nominatedText upon which to construct%0A     * @param electees the list of indices into the text list corresponding to elected entries%0A     */%0A
     public Elect
@@ -1941,24 +1941,132 @@
   );%0A    %7D%0A%0A
+    /**%0A     * Constructs as a copy of the input.%0A     * @param electedText the ElectedText to copy%0A     */%0A
     public E

Document ElectedText