package at.medunigraz.imi.abbres.resolver;

import java.util.NavigableSet;
import java.util.TreeSet;

import at.medunigraz.imi.abbres.model.Abbreviation;
import at.medunigraz.imi.abbres.model.NGramMapFactory;
import at.medunigraz.imi.abbres.model.mapper.FuzzyMapper;
import at.medunigraz.imi.abbres.model.mapper.Mapper;
import at.medunigraz.imi.abbres.model.mapper.StrictMapper;
import at.medunigraz.imi.abbres.model.matcher.LeftBigramMatcher;
import at.medunigraz.imi.abbres.model.matcher.Matcher;
import at.medunigraz.imi.abbres.model.matcher.RightBigramMatcher;
import at.medunigraz.imi.abbres.model.matcher.UnigramMatcher;
import at.medunigraz.imi.abbres.model.reducer.FuzzyBigramWithFallbackReducer;

public class DefaultResolver implements Resolver {

	public DefaultResolver() {
		NGramMapFactory.warm();
	}

	@Override
	public String resolve(Abbreviation abbreviation) {
		Matcher unigram = new UnigramMatcher(abbreviation);
		Matcher leftBigram = new LeftBigramMatcher(abbreviation);
		Matcher rightBigram = new RightBigramMatcher(abbreviation);

		Mapper strictUnigram = new StrictMapper(unigram);
		Mapper strictLeftBigram = new StrictMapper(leftBigram);
		Mapper strictRightBigram = new StrictMapper(rightBigram);

		Mapper fuzzyUnigram = new FuzzyMapper(unigram);
		Mapper fuzzyLeftBigram = new FuzzyMapper(leftBigram);
		Mapper fuzzyRightBigram = new FuzzyMapper(rightBigram);

		NavigableSet<Mapper> set = new TreeSet<>();
		set.add(strictUnigram);
		set.add(strictLeftBigram);
		set.add(strictRightBigram);
		set.add(fuzzyUnigram);
		set.add(fuzzyLeftBigram);
		set.add(fuzzyRightBigram);

		return new FuzzyBigramWithFallbackReducer().reduce(set);
	}
}

@@ -247,21 +247,16 @@
 .mapper.
-Fuzzy
 Mapper;%0A
@@ -304,67 +304,14 @@
 per.
-Mapper;%0Aimport at.medunigraz.imi.abbres.model.mapper.Strict
+Single
 Mapp
@@ -554,32 +554,202 @@
 UnigramMatcher;%0A
+import at.medunigraz.imi.abbres.model.policy.FuzzyPolicy;%0Aimport at.medunigraz.imi.abbres.model.policy.Policy;%0Aimport at.medunigraz.imi.abbres.model.policy.StrictPolicy;%0A
 import at.meduni
@@ -1159,16 +1159,57 @@
 iation);
+%0A%09%09%0A%09%09Policy strict = new StrictPolicy();
 %0A%0A%09%09Mapp
@@ -1228,29 +1228,29 @@
 gram = new S
-trict
+ingle
 Mapper(unigr
@@ -1243,32 +1243,40 @@
 leMapper(unigram
+, strict
 );%0A%09%09Mapper stri
@@ -1291,29 +1291,29 @@
 gram = new S
-trict
+ingle
 Mapper(leftB
@@ -1309,32 +1309,40 @@
 apper(leftBigram
+, strict
 );%0A%09%09Mapper stri
@@ -1362,21 +1362,21 @@
  = new S
-trict
+ingle
 Mapper(r
@@ -1381,24 +1381,71 @@
 (rightBigram
+, strict);%0A%09%09%0A%09%09Policy fuzzy = new FuzzyPolicy(
 );%0A%0A%09%09Mapper
@@ -1460,29 +1460,30 @@
 igram = new 
-Fuzzy
+Single
 Mapper(unigr
@@ -1480,24 +1480,31 @@
 pper(unigram
+, fuzzy
 );%0A%09%09Mapper 
@@ -1521,29 +1521,30 @@
 igram = new 
-Fuzzy
+Single
 Mapper(leftB
@@ -1544,24 +1544,31 @@
 r(leftBigram
+, fuzzy
 );%0A%09%09Mapper 
@@ -1590,21 +1590,22 @@
 m = new 
-Fuzzy
+Single
 Mapper(r
@@ -1610,24 +1610,31 @@
 (rightBigram
+, fuzzy
 );%0A%0A%09%09Naviga

Change DefaultResolver to use new classes