package com.grayben.riskExtractor.htmlScorer.partScorers.tagScorers;

import com.grayben.riskExtractor.htmlScorer.partScorers.Scorer;
import org.jsoup.parser.Tag;

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

public class TagEmphasisScorer
		extends Scorer<Tag> {

    public static final String SCORE_LABEL = "tag-emphasis";
	
	Map<Tag, Integer> tagScores = null;

	TagEmphasisScorer(Map<Tag, Integer> tagScores) {
		super(SCORE_LABEL);
        this.tagScores = tagScores;
	}

	public static final Map<Tag, Integer> defaultMap() {
		
		//Map<Tag, Integer> tagScores = this.getTagScores();
		Map<Tag, Integer> tagScoreMap = new HashMap<>();
		tagScoreMap.put(Tag.valueOf("b"), 1);
		tagScoreMap.put(Tag.valueOf("strong"), 1);
		tagScoreMap.put(Tag.valueOf("h1"), 1);
		tagScoreMap.put(Tag.valueOf("h2"), 1);
		tagScoreMap.put(Tag.valueOf("h3"), 1);
		tagScoreMap.put(Tag.valueOf("h4"), 1);
		tagScoreMap.put(Tag.valueOf("h5"), 1);
		tagScoreMap.put(Tag.valueOf("u"), 1);
		
		return tagScoreMap;
		
	}

	@Override
	public int score(Tag input) {
		throw new UnsupportedOperationException
                ("This method is not implemented");
	}

	@Override
	public String getScoreLabel() {
		return null;
	}


}

@@ -1048,38 +1048,319 @@
 %7B%0A%09%09
-throw new UnsupportedOperation
+validateTagInput(input);%0A        String inputName = input.getName();%0A        if (tagScores.containsKey(inputName))%0A            return tagScores.get(inputName);%0A        else%0A            return 0;%0A%09%7D%0A%0A    public static void validateTagInput(Tag input)%7B%0A        if(input == null)%7B%0A            throw new NullPointer
 Exce
@@ -1364,16 +1364,17 @@
 xception
+(
 %0A       
@@ -1386,45 +1386,381 @@
     
-(%22This method is not implemented%22);%0A%09
+    %22Input cannot be null%22%0A            );%0A        %7D%0A        if(input.isEmpty())%7B%0A            throw new IllegalArgumentException(%0A                    %22Input cannot be empty%22%0A            );%0A        %7D%0A        if(input.getName().isEmpty())%7B%0A            throw new IllegalArgumentException(%0A                    %22Input Tag must have a non-empty name%22%0A            );%0A        %7D%0A    
 %7D%0A%0A%09

Implement draft