// Path: src/us/pfrommer/insteon/terminal/console/History.java
// public class History {
// 	private String[] m_history;
// 	private int m_count = 0;
// 	private int m_last = -1;
// 	
// 	public History(int size) {
// 		m_history = new String[size];
// 	}
// 	
// 	public int length() { return m_count; }
// 	
// 	//Previous is from 0-histoy.length -1
// 	//0 is the last thing entered
// 	// and history.length - 1 is the first thing entered
// 	public String get(int previous) {
// 		if (m_last < 0) return null;
// 		if (previous >= m_count) return null;
// 				
// 		int idx = Math.min(m_last, Math.max(0, m_last - previous));
// 		
// 		while (idx < 0) {
// 			idx += m_history.length;
// 		}
// 		
// 		return m_history[idx];
// 	}
// 	
// 	public void add(String s) {
// 		String l = get(0);
// 		if (l != null && l.equals(s)) return; //Don't store duplicate entries
// 		
// 		int idx = m_last + 1;
// 		if (idx >= m_history.length) {
// 			idx -= m_history.length;
// 		}
// 		m_history[idx] = s;
// 		
// 		m_last = idx;
// 		
// 		m_count = Math.max(m_history.length, m_count++);
// 	}
// }


import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.io.IOException;
import java.io.PipedReader;
import java.io.PipedWriter;
import java.io.Reader;
import java.util.Scanner;
import java.util.concurrent.CopyOnWriteArrayList;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.InputMap;
import javax.swing.JTextField;
import javax.swing.KeyStroke;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.DocumentFilter;
import javax.swing.text.PlainDocument;
import javax.swing.text.SimpleAttributeSet;
import us.pfrommer.insteon.terminal.console.History;
package us.pfrommer.insteon.terminal.console.gui;




public class InputArea extends JTextField {
	private static final long serialVersionUID = 1L;
	
	private InputAreaReader m_reader = null;
	private Scanner m_scanner = null;
	
// Path: src/us/pfrommer/insteon/terminal/console/History.java
// public class History {
// 	private String[] m_history;
// 	private int m_count = 0;
// 	private int m_last = -1;
// 	
// 	public History(int size) {
// 		m_history = new String[size];
// 	}
// 	
// 	public int length() { return m_count; }
// 	
// 	//Previous is from 0-histoy.length -1
// 	//0 is the last thing entered
// 	// and history.length - 1 is the first thing entered
// 	public String get(int previous) {
// 		if (m_last < 0) return null;
// 		if (previous >= m_count) return null;
// 				
// 		int idx = Math.min(m_last, Math.max(0, m_last - previous));
// 		
// 		while (idx < 0) {
// 			idx += m_history.length;
// 		}
// 		
// 		return m_history[idx];
// 	}
// 	
// 	public void add(String s) {
// 		String l = get(0);
// 		if (l != null && l.equals(s)) return; //Don't store duplicate entries
// 		
// 		int idx = m_last + 1;
// 		if (idx >= m_history.length) {
// 			idx -= m_history.length;
// 		}
// 		m_history[idx] = s;
// 		
// 		m_last = idx;
// 		
// 		m_count = Math.max(m_history.length, m_count++);
// 	}
// }


// Path: src/us/pfrommer/insteon/terminal/console/gui/InputArea.java
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.io.IOException;
import java.io.PipedReader;
import java.io.PipedWriter;
import java.io.Reader;
import java.util.Scanner;
import java.util.concurrent.CopyOnWriteArrayList;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.InputMap;
import javax.swing.JTextField;
import javax.swing.KeyStroke;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.DocumentFilter;
import javax.swing.text.PlainDocument;
import javax.swing.text.SimpleAttributeSet;
import us.pfrommer.insteon.terminal.console.History;

package us.pfrommer.insteon.terminal.console.gui;




public class InputArea extends JTextField {
	private static final long serialVersionUID = 1L;
	
	private InputAreaReader m_reader = null;
	private Scanner m_scanner = null;
	
	private History m_history = null;