package com.grayben.riskExtractor.htmlScorer;

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

public class ScoredText {
	private List<ScoredTextElement> text;

	public ScoredText() {
		super();
		text = new ArrayList<>();
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		for (ScoredTextElement element : text) {
			sb.append(element.getTextElement());
			sb.append(" ");
		}
		return sb.toString().trim();
	}

	public void add(ScoredTextElement st) {
        if(st.getScores() == null){
            throw new NullPointerException(
                    "param.getScores() must not be null"
            );
        }
        if(st.getScores().isEmpty()){
            throw new IllegalArgumentException(
                    "param.getScores() must not be empty"
            );
        }
        if(st.getTextElement() == null){
            throw new NullPointerException(
                    "param.getTextElement() must not be null"
            );
        }
        if(st.getTextElement().isEmpty()){
            throw new IllegalArgumentException(
                    "param.getTextElement() must not be empty"
            );
        }
		text.add(st);
	}
}

@@ -68,16 +68,46 @@
 ayList;%0A
+import java.util.Collections;%0A
 import j
@@ -1217,11 +1217,117 @@
 (st);%0A%09%7D
+%0A%0A%09public List%3CScoredTextElement%3E getList()%7B%0A        return Collections.unmodifiableList(this.text);%0A    %7D
 %0A%7D%0A

Add access to list of elements