<commit_before>package nl.mpi.arbil.ui.fieldeditors;

import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.StringTokenizer;
import javax.swing.ComboBoxEditor;
import javax.swing.JComboBox;
import javax.swing.JTextField;
import javax.swing.Timer;

/**
 *
 * @author <NAME> <<EMAIL>>
 */
public abstract class TypeAheadComboBoxEditor implements ComboBoxEditor, FocusListener, KeyListener {

    /**
     * Gets requested item from vocabulary by index
     * @param index
     * @return Requested item
     */
    protected abstract String getItemAt(int index);

    /**
     * 
     * @return Total number of items
     */
    protected abstract int getItemsCount();

    /**
     * 
     * @return Whether multiple items can be entered
     */
    protected abstract boolean isList();

    /**
     * 
     * @return Whether arbitrary items can be entered
     */
    protected abstract boolean isOpen();

    protected TypeAheadComboBoxEditor(JTextField editor, String initialValue, String originalValue, JComboBox comboBox) {
	this.editor = editor;
	if (comboBox != null) {
	    setComboBox(comboBox);
	    // Also set combobox item to initial value because it will feed its selected item
	    // back into the setItem method of this object
	    comboBox.setSelectedItem(initialValue);
	}

	this.originalValue = originalValue;
    }

    protected final void init() {
	getTextField().addKeyListener(this);
	getTextField().addFocusListener(this);

	initTypeaheadTimer();
    }

    public TypeAheadComboBoxEditor() {
    }
<commit_msg>Added some javadoc to TypeAheadComboBoxEditor and removed default constructor<commit_after>package nl.mpi.arbil.ui.fieldeditors;

import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.StringTokenizer;
import javax.swing.ComboBoxEditor;
import javax.swing.JComboBox;
import javax.swing.JTextField;
import javax.swing.Timer;

/**
 *
 * @author <NAME> <<EMAIL>>
 */
public abstract class TypeAheadComboBoxEditor implements ComboBoxEditor, FocusListener, KeyListener {

    /**
     * Gets requested item from vocabulary by index
     * @param index
     * @return Requested item
     */
    protected abstract String getItemAt(int index);

    /**
     * 
     * @return Total number of items
     */
    protected abstract int getItemsCount();

    /**
     * 
     * @return Whether multiple items can be entered
     */
    protected abstract boolean isList();

    /**
     * 
     * @return Whether arbitrary items can be entered
     */
    protected abstract boolean isOpen();

    /**
     * Constructor. Call init() after this!
     * @param editor Editor component
     * @param initialValue Initial value for editor
     * @param originalValue Original value for editor (will revert to this at escape)
     * @param comboBox Combobox this will be editor for
     * @see init()
     */
    protected TypeAheadComboBoxEditor(JTextField editor, String initialValue, String originalValue, JComboBox comboBox) {
	this.editor = editor;
	if (comboBox != null) {
	    setComboBox(comboBox);
	    // Also set combobox item to initial value because it will feed its selected item
	    // back into the setItem method of this object
	    comboBox.setSelectedItem(initialValue);
	}

	this.originalValue = originalValue;
    }

    /**
     * Initializes editor. Initializes key and focus listeners and the timer. Must be called in constructor! 
     */
    protected final void init() {
	getTextField().addKeyListener(this);
	getTextField().addFocusListener(this);

	initTypeaheadTimer();
    }

{'fraction_non_alphanumeric': 0.09188088572155764, 'fraction_numerical': 0.0, 'mean_word_length': 3.3959731543624163, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6002597', 'n_tokens_mistral': 1116, 'n_tokens_neox': 1062, 'n_words': 326}