package com.grayben.riskExtractor.headingMarker;

import org.apache.commons.collections4.list.SetUniqueList;

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

public class NominatedText
		extends UnmodifiableText
		implements NomineesRetrievable<String> {

    private SetUniqueList<Integer> nominees;

    public NominatedText(List<String> stringList, SetUniqueList<Integer> nominees) {
        super(stringList);
        if (nominees == null) {
            throw new NullPointerException("Attempted to pass null argument");
        }
        this.nominees = nominees;
    }

    public NominatedText(
            UnmodifiableText unmodifiableText,
            SetUniqueList<Integer> nominees){
        super(unmodifiableText);
        if (nominees == null) {
            throw new NullPointerException("Attempted to pass null argument");
        }
        this.nominees = nominees;
    }

    public NominatedText(NominatedText nominatedText){
        this(nominatedText, nominatedText.getNomineeIndices());
    }

    @Override
    public SetUniqueList<Integer> getNomineeIndices() {
        SetUniqueList<Integer> newList = SetUniqueList.setUniqueList(
                new ArrayList<>()
        );
        newList.addAll(this.nominees);
        return newList;
    }
}

@@ -155,16 +155,149 @@
 .List;%0A%0A
+/**%0A * %7B@link UnmodifiableText%7D for which zero or more entries have been deemed 'nominees.'%0A * %3Cp%3E%0A * Created by Ben Gray, 2015.%0A */%0A
 public c
@@ -386,16 +386,98 @@
 ing%3E %7B%0A%0A
+    /**%0A     * The indices into %7B@link #stringList%7D identifying nominees.%0A     */%0A
     priv
@@ -514,12 +514,202 @@
 inee
+Indice
 s;%0A%0A
+    /**%0A     * Construct 'from scratch'.%0A     * @param stringList the list of strings containing the text entries%0A     * @param nomineeIndices the indices identifying nominees%0A     */%0A
     
@@ -784,16 +784,22 @@
  nominee
+Indice
 s) %7B%0A   
@@ -833,32 +833,38 @@
      if (nominee
+Indice
 s == null) %7B%0A   
@@ -961,32 +961,38 @@
     this.nominee
+Indice
 s = nominees;%0A  
@@ -978,32 +978,38 @@
 ndices = nominee
+Indice
 s;%0A    %7D%0A%0A    pu
@@ -994,32 +994,202 @@
 Indices;%0A    %7D%0A%0A
+    /**%0A     * Construct incrementally.%0A     * @param unmodifiableText the text upon which to build%0A     * @param nomineeIndices the indices identifying nominees%0A     */%0A
     public Nomin
@@ -1287,16 +1287,22 @@
  nominee
+Indice
 s)%7B%0A    
@@ -1349,16 +1349,22 @@
 (nominee
+Indice
 s == nul
@@ -1477,16 +1477,22 @@
 .nominee
+Indice
 s = nomi
@@ -1494,16 +1494,22 @@
  nominee
+Indice
 s;%0A    %7D
@@ -1506,24 +1506,112 @@
 ces;%0A    %7D%0A%0A
+    /**%0A     * Construct a copy.%0A     * @param nominatedText the object to copy%0A     */%0A
     public N
@@ -1944,16 +1944,22 @@
 .nominee
+Indice
 s);%0A    

Document NominatedText