package opennlp.ccg.lexicon;

import java.util.Map;

/**
 * A morphological/graphological/phonologial muster
 * 
 * @author Daniel Couto-Vale
 */
public class Muster {

	/**
	 * A muster sequence of characters
	 */
	private final String form;

	/**
	 * A muster sequence of pitches
	 */
	private final String tone;

	/**
	 * A parallel map
	 */
	private final Map<String, String> parallelMap;

	/**
	 * Constructoe
	 * 
	 * @param form the muster sequence of characters
	 * @param tone the muster sequence of pitches
	 * @param parallelMap parallel musters
	 */
	public Muster(String form, String tone, Map<String, String> parallelMap) {
		this.form = form;
		this.tone = tone;
		this.parallelMap = parallelMap;
	}

	/**
	 * @return the form to recognize
	 */
    public final String getForm() {
    	return form;
    }

    /**
     * @return the tone to recognize
     */
    public final String getTone() {
    	return tone;
    }

    /**
     * @return the parallel map
     */
    public final Map<String, String> getParallelMap() {
    	return parallelMap;
    }

    /**
     * Gets the parallel key
     * 
     * @param parallelKey the parallel key
     * @return the parallel
     */
    public String getParallel(String parallelKey) {
    	return parallelMap.get(parallelKey);
    }

}

@@ -23,16 +23,97 @@
 xicon;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.Collections;%0Aimport java.util.List;%0A
 import j
@@ -239,16 +239,46 @@
 s Muster
+ implements Comparable%3CMuster%3E
  %7B%0A%0A%09/**
@@ -1400,10 +1400,876 @@
 %0A    %7D%0A%0A
+%09@Override%0A%09public int compareTo(Muster o) %7B%0A%09%09int compare = 0;%0A%09%09compare = form.compareTo(o.form);%0A%09%09if (compare != 0) return compare;%0A%09%09compare = tone.compareTo(o.tone);%0A%09%09if (compare != 0) return compare;%0A%09%09compare = parallelMap.size() - o.parallelMap.size();%0A%09%09if (compare != 0) return compare;%0A%09%09List%3CString%3E keyList = new ArrayList%3CString%3E(parallelMap.keySet());%0A%09%09List%3CString%3E oKeyList = new ArrayList%3CString%3E(o.parallelMap.keySet());%0A%09%09Collections.sort(keyList);%0A%09%09Collections.sort(oKeyList);%0A%09%09for (int i = 0; i %3C keyList.size(); i++) %7B%0A%09%09%09String key = keyList.get(i);%0A%09%09%09String oKey = oKeyList.get(i);%0A%09%09%09compare = key.compareTo(oKey);%0A%09%09%09if (compare != 0) return compare;%0A%09%09%09String value = parallelMap.get(key);%0A%09%09%09String oValue = parallelMap.get(oKey);%0A%09%09%09compare = value.compareTo(oValue);%0A%09%09%09if (compare != 0) return compare;%0A%09%09%7D%0A%09%09return compare;%0A%09%7D%0A%0A
 %7D%0A

Make muster comparable