java.lang.Object com.realtime.crossfire.jxclient.settings.CommandHistory
public class CommandHistory
Manages a list of previously entered commands.
Field Summary | |
---|---|
private int |
commandIndex
The current command index. |
private java.util.List<java.lang.String> |
commands
The commands. |
private static int |
HISTORY_SIZE
The maximum number of commands to store. |
Constructor Summary | |
---|---|
CommandHistory(java.lang.String ident)
Creates a new instance. |
Method Summary | |
---|---|
void |
addCommand(java.lang.String command)
Adds a new command. |
java.lang.String |
down()
Returns the next command. |
private void |
removeCommand(java.lang.String command)
Removes a command. |
private void |
trimToMaxSize()
Cut off old entries if more than HISTORY_SIZE commands are
present. |
java.lang.String |
up()
Returns the previous command. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int commandIndex
@NotNull private final java.util.List<java.lang.String> commands
private static final int HISTORY_SIZE
Constructor Detail |
---|
public CommandHistory(@NotNull java.lang.String ident)
ident
- the identification string for backing up to fileMethod Detail |
---|
public void addCommand(@NotNull java.lang.String command)
command
- the command to add@Nullable public java.lang.String down()
null
if no previous command
existsprivate void removeCommand(@NotNull java.lang.String command)
command
- the command to removeprivate void trimToMaxSize()
HISTORY_SIZE
commands are
present.
@Nullable public java.lang.String up()
null
if no previous command
exists