Initial revision
[old-projects.git] / ekit / com / swabunga / spell / event / WordTokenizer.java
diff --git a/ekit/com/swabunga/spell/event/WordTokenizer.java b/ekit/com/swabunga/spell/event/WordTokenizer.java
new file mode 100644 (file)
index 0000000..1992c10
--- /dev/null
@@ -0,0 +1,33 @@
+package com.swabunga.spell.event;\r\r
+\r\r
+/** This interface returns words.\r\r
+ *  It also allows for the current word to be mutated\r\r
+ *\r\r
+ * @author Jason Height (jheight@chariot.net.au)\r\r
+ */\r\r
+public interface WordTokenizer {\r\r
+  /** Returns true iif there are more words left*/\r\r
+  public boolean hasMoreWords();\r\r
+  /**Returns an index representing the start location in the original set of words*/\r\r
+  public int getCurrentWordPosition();\r\r
+  /**Returns an index representing the end location in the original set of words*/\r\r
+  public int getCurrentWordEnd();\r\r
+\r\r
+  /** Returns the next word token*/\r\r
+  public String nextWord();\r\r
+  /** Returns the number of word tokens that have been processed thus far*/\r\r
+  public int getCurrentWordCount();\r\r
+  /** Replaces the current word token\r\r
+   * <p>When a word is replaced care should be taken that the WordTokenizer\r\r
+   * repositions itself such that the words that were added arent rechecked. Of\r\r
+   * course this is not mandatory, maybe there is a case when an application\r\r
+   * doesnt need to do this.</p>\r\r
+   */\r\r
+  public void replaceWord(String newWord);\r\r
+  /** Returns the context text that is being tokenized (should include any changes\r\r
+   *  that have been made)\r\r
+   */\r\r
+  public String getContext();\r\r
+  /** Returns true iif the current word is at the start of a sentance*/\r\r
+  public boolean isNewSentance();\r\r
+}
\ No newline at end of file