/*******************************************************************************
 *
 * The MIT License (MIT)
 *
 * Copyright (c) 2016 FieryIce0x10
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy 
 * of this software and associated documentation files (the "Software"), to deal 
 * in the Software without restriction, including without limitation the rights 
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
 * copies of the Software, and to permit persons to whom the Software is 
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in 
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 *******************************************************************************/
package nl.fieryice0x10.mc.unify;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * 
 */
public class Config implements Iterable<String> {
	private Map<String, List<String>> replacements;
	
	public Config() {
		replacements = new HashMap<String, List<String>>();
	}
	
	public List<String> getReplacements(String dictTag) {
		return replacements.get(dictTag);
	}
	
	public void addReplacements(String dictTag, List<String> items) {
		replacements.put(dictTag, items);
	}
	
	public void addEmptyReplacements(String dictTag) {
		replacements.put(dictTag, new ArrayList<String>());
	}
	
	@Override
	public Iterator<String> iterator() {
		return replacements.keySet().iterator();
	}
	
	public Set<String> dictTagSet() {
		return replacements.keySet();
	}
}

@@ -222,17 +222,16 @@
 g a copy
- 
 %0A * of t
@@ -303,17 +303,16 @@
  to deal
- 
 %0A * in t
@@ -383,17 +383,16 @@
 e rights
- 
 %0A * to u
@@ -460,17 +460,16 @@
 /or sell
- 
 %0A * copi
@@ -533,17 +533,16 @@
 tware is
- 
 %0A * furn
@@ -674,17 +674,16 @@
 luded in
- 
 %0A * all 
@@ -807,17 +807,16 @@
  EXPRESS
- 
 %0A * OR I
@@ -869,17 +869,16 @@
 NTIES OF
- 
 %0A * MERC
@@ -943,17 +943,16 @@
 NGEMENT.
- 
 %0A * IN N
@@ -1015,17 +1015,16 @@
  FOR ANY
- 
 %0A * CLAI
@@ -1087,17 +1087,16 @@
 ONTRACT,
- 
 %0A * TORT
@@ -1156,17 +1156,16 @@
 WITH THE
- 
 %0A * SOFT
@@ -1491,16 +1491,91 @@
 %0A/**%0A * 
+Configuration containing the replacement item id's for the dictionary tags.
 %0A */%0Apub
@@ -1673,23 +1673,16 @@
 nts;%0A%09%0A%09
-public 
 Config()
@@ -1748,210 +1748,922 @@
 %0A%09%0A%09
-public List%3CString%3E getReplacements(String dictTag) %7B%0A%09%09return replacements.get(dictTag);%0A%09%7D%0A%09%0A%09public void addReplacements(String dictTag, List%3CString%3E items) %7B%0A%09%09replacements.put(dictTag, items);%0A%09%7D%0A%09
+/**%0A%09 * Get the list of configured replacements for a given dictionary tag.%0A%09 * The higher on the list, the higher the priority.%0A%09 * %0A%09 * @param dictTag%0A%09 *            the dictionary tag%0A%09 * @return a list of possible replacement item id's, or null if the tag is%0A%09 *         unknown%0A%09 */%0A%09public List%3CString%3E getReplacements(String dictTag) %7B%0A%09%09return replacements.get(dictTag);%0A%09%7D%0A%09%0A%09/**%0A%09 * Add a list of item id's for a specific dictionary tag.%0A%09 * %0A%09 * @param dictTag%0A%09 *            the dictionary tag%0A%09 * @param items%0A%09 *            the list of item id's%0A%09 */%0A%09public void addReplacements(String dictTag, List%3CString%3E items) %7B%0A%09%09replacements.put(dictTag, items);%0A%09%7D%0A%09%0A%09/**%0A%09 * Add a empty list of item id's for a specific dictionary tag. This makes%0A%09 * sure it is inserted into the config file, allowing future runs to%0A%09 * recognize the dict tag.%0A%09 * %0A%09 * @param dictTag%0A%09 *            the dictionary tag%0A%09 */
 %0A%09pu
@@ -2867,16 +2867,121 @@
 );%0A%09%7D%0A%09%0A
+%09/**%0A%09 * Get the set of dictionary tags in this config.%0A%09 * %0A%09 * @return the set of dictionary tags%0A%09 */%0A
 %09public 

Add Config javadoc