
import java.util.*;

public class Concordance {

private Dictionary dict = new Hashtable();

private boolean allowDupl = true;

public Concordance (boolean allowDupl ) {
    this.allowDupl = allowDupl;
}  

public Concordance ( ) { this(true); }

public void enterWord (Object word, Integer line) {
    Vector set = (Vector) dict.get(word);
    if (set == null) {   
	set = new Vector( );
	dict.put(word, set);   
    }  
    if (allowDupl || !set.contains(line)) 
	set.addElement(line);
}  

public Enumeration keys( ) {
    return dict.keys( );
}  

public Enumeration getNumbers (Object word) {
    return ((Vector)dict.get(word)).elements( );
}  

}  
