edu.northwestern.at.wordhoard.model
Class ColocatePreloader

java.lang.Object
  extended by edu.northwestern.at.wordhoard.model.ColocatePreloader

public class ColocatePreloader
extends java.lang.Object

A colocate preloader.

A colocate preloader dramatically improves performance when many colocates for words are needed, as in a KWIC display. It loads up large batches of colocates in advance instead of loading them one at a time.


Constructor Summary
ColocatePreloader(PersistenceManager pm)
          Creates a new colocate preloader.
 
Method Summary
 void add(java.util.List words)
          Adds a list of words to the preloader.
 void load(Word word, int distance, int lookahead)
          Preloads colocates for words.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColocatePreloader

public ColocatePreloader(PersistenceManager pm)
Creates a new colocate preloader.

Parameters:
pm - Persistence manager.
Method Detail

add

public void add(java.util.List words)
Adds a list of words to the preloader.

Parameters:
words - List of words.

load

public void load(Word word,
                 int distance,
                 int lookahead)
          throws PersistenceException
Preloads colocates for words.

Loads the colocates preceding and following the word, plus preceding and following colocates for words following the word in its list.

Parameters:
word - The word.
distance - The number of preceding and following colocates to preload.
lookahead - This many additional words following the word in its list also have their colocates preloaded.
Throws:
PersistenceException