--- /dev/null
+package com.swabunga.spell.engine;\r\r
+\r\r
+import java.util.Comparator;\r\r
+\r\r
+/** The Word object holds both the string and the score.\r\r
+ * <p>This class is now immutable.\r\r
+ * </p>\r\r
+ */\r\r
+public class Word implements Comparator {\r\r
+ private String word;\r\r
+ private int score;\r\r
+\r\r
+ public Word() { \r\r
+ }\r\r
+ \r\r
+ public Word(String word, int score) {\r\r
+ this.word = word;\r\r
+ this.score = score;\r\r
+ }\r\r
+\r\r
+ /** The comparator interface*/\r\r
+ public int compare(Object o1, Object o2) {\r\r
+ if (((Word) o1).getScore() < ((Word) o2).getScore()) return -1;\r\r
+ if (((Word) o1).getScore() == ((Word) o2).getScore()) return 0;\r\r
+ return 1;\r\r
+ }\r\r
+\r\r
+ public String getWord() {\r\r
+ return word;\r\r
+ }\r\r
+\r\r
+ public int getScore() {\r\r
+ return score;\r\r
+ }\r\r
+\r\r
+ public String toString() {\r\r
+ return word;\r\r
+ }\r\r
+}\r\r
+\r\r