package com.grayben.riskExtractor.htmlScorer;

import java.util.HashMap;
import java.util.Map;

public class ScoredTextElement {
	private String textElement = null;
	Map<String, Integer> scores = new HashMap<String, Integer>(8, 0.5f);
	
	public ScoredTextElement(String text, Map<String, Integer> scores) {
		super();
		if(text == null){
			throw new NullPointerException(
					"Tried to pass in null text:String"
			);
		}
        if(text.equals("")){
            throw new IllegalArgumentException(
                    "Tried to pass in empty String"
            );
        }
        if(text.matches("^\\s*$")){
            throw new IllegalArgumentException(
                    "Tried to pass in string with no non-whitespace characters"
            );
        }
		if(scores == null) {
            throw new NullPointerException(
                    "Tried to pass in null currentScores:Map<Integer, Integer>"
            );
        }
		if(scores.isEmpty()){
			throw new IllegalArgumentException(
                    "Tried to pass in empty currentScores:Map<Integer, Integer>"
            );
		}
		this.textElement = text;
		this.scores = scores;
	}
	
	public String getTextElement() {
		return textElement;
	}
	
	public Map<String, Integer> getScores() {
		return scores;
	}
	
}

@@ -40,16 +40,46 @@
 corer;%0A%0A
+import java.util.Collections;%0A
 import j
@@ -1294,22 +1294,51 @@
 %09return 
+Collections.unmodifiableMap(
 scores
+)
 ;%0A%09%7D%0A%09%0A%7D

Make ScoredTextElement unmodifiable