|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jmol.util.CommandHistory
public final class CommandHistory
Implements a queue for a bash-like command history.
Field Summary | |
---|---|
private List |
commandList
Array of commands. |
private int |
cursorPos
Current position of the cursor; |
(package private) static int |
DEFAULT_MAX_SIZE
|
static String |
ERROR_FLAG
|
(package private) boolean |
isOn
|
private int |
maxSize
|
private int |
nextCommand
Position of the next command. |
static String |
NOHISTORYATALL_FLAG
|
static String |
NOHISTORYLINE_FLAG
|
Constructor Summary | |
---|---|
CommandHistory()
Creates a new instance using the default size (100) |
|
CommandHistory(int maxSize)
Creates a new instance. |
Method Summary | |
---|---|
void |
addCommand(String strCommand)
Adds any number of lines to the command history |
private void |
addCommandLine(String command)
Adds a single line to the bottom of the list, resets list position. |
void |
clear()
clears the history. |
private String |
getCommand()
Calculates the command to return. |
String |
getCommandDown()
Retrieves the following command from the top of the list, updates list position. |
String |
getCommandUp()
Retrieves the following command from the bottom of the list, updates list position. |
String |
getSetHistory(int n)
Options include: all Integer.MAX_VALUE n prev n >= 1 next -1 set max to -2 - n n <= -3 just clear -2 clear and turn off; return "" 0 clear and turn on; return "" Integer.MIN_VALUE; |
String |
removeCommand()
|
String |
removeCommand(int n)
|
void |
reset(int maxSize)
Resets instance. |
void |
setMaxSize(int maxSize)
Resets maximum size of command queue. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String ERROR_FLAG
public static final String NOHISTORYLINE_FLAG
public static final String NOHISTORYATALL_FLAG
static final int DEFAULT_MAX_SIZE
private List commandList
private int maxSize
private int nextCommand
private int cursorPos
boolean isOn
Constructor Detail |
---|
public CommandHistory()
public CommandHistory(int maxSize)
maxSize
- maximum size for the command queueMethod Detail |
---|
public void clear()
public void reset(int maxSize)
maxSize
- maximum size for the command queue.public void setMaxSize(int maxSize)
maxSize
- maximum size for the command queue.public String getCommandUp()
public String getCommandDown()
private String getCommand()
public void addCommand(String strCommand)
strCommand
- public String getSetHistory(int n)
n
-
public String removeCommand()
public String removeCommand(int n)
private void addCommandLine(String command)
command
- the String value of a command.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |