public void calculateStatistics(Analysis analysis) {
   Iterator iter = completions.keySet().iterator();
   while (iter.hasNext()) {
     String key = (String) iter.next();
     WordEntry we = (WordEntry) completions.get(key);
     we.calculateStatistics(analysis);
   }
 }
 public void add(String word) {
   WordEntry we = (WordEntry) completions.get(word);
   if (we == null) {
     we = new WordEntry(word);
     completions.put(word, we);
   }
   we.inc();
   nEntries++;
 }
  public String choose() {
    int ran = Math.abs(Analysis.random.nextInt() % nEntries);
    Iterator iter = completions.keySet().iterator();
    int sum = 0;

    while (iter.hasNext()) {
      String key = (String) iter.next();
      WordEntry we = (WordEntry) completions.get(key);
      if (we == null) throw new NullPointerException();
      sum += we.getnEntries();
      if (ran <= sum) return we.word;
    }
    throw new NullPointerException("Cannot get here");
  }
 public void getMarkerWord(WordEntry we) {
   we.set(markerWord);
 }