package at.medunigraz.imi.abbres.model.mapper;

import java.util.Map;
import java.util.TreeMap;

import at.medunigraz.imi.abbres.TextUtils;
import at.medunigraz.imi.abbres.model.matcher.Matcher;

public class StrictMapper extends AbstractMapper {

	public StrictMapper(Matcher matcher) {
		super(matcher);
	}
	
	@Override
	public Map<String, Integer> map() {
		String prefix = prefix();
		String suffix = matcher.suffix();

		Map<String, Integer> subMap = matcher.submap(prefix, suffix);
		Map<String, Integer> ret = new TreeMap<>();

		for (Map.Entry<String, Integer> entry : subMap.entrySet()) {
			String expansion = matcher.expansion(entry.getKey());
			if (matcher.isValidExpansion(expansion)) {
				ret.put(expansion, entry.getValue());
			}
		}

		return ret;
	}
	
	public String prefix() {
		String trimmedAbbrev = matcher.getAbbreviation().getTrimmedToken();
		return matcher.prefix().concat(trimmedAbbrev);
	}

}

@@ -94,51 +94,8 @@
 p;%0A%0A
-import at.medunigraz.imi.abbres.TextUtils;%0A
 impo
@@ -259,17 +259,16 @@
 er);%0A%09%7D%0A
-%09
 %0A%09@Overr
@@ -719,17 +719,16 @@
 ret;%0A%09%7D%0A
-%09
 %0A%09public

Remove unused imports