currentWordPos = getNextWordStart(text, text.getBeginIndex());
currentWordPos = getNextWordStart(text, 0);
  public DocumentWordTokenizer(Document document) {    this.document = document;    //Create a text segment over the etire document    text = new Segment();    sentenceIterator = BreakIterator.getSentenceInstance();    try {      document.getText(0, document.getLength(), text);      sentenceIterator.setText(text);      currentWordPos = getNextWordStart(text, text.getBeginIndex());      //If the current word pos is -1 then the string was all white space      if (currentWordPos != -1) {        currentWordEnd = getNextWordEnd(text, currentWordPos);        nextWordPos = getNextWordStart(text, currentWordEnd);      } else {        moreTokens = false;      }    } catch (BadLocationException ex) {      moreTokens = false;    }  }