Crossfire JXClient, Trunk
|
Public Member Functions | |
void | addCommand (@NotNull final String command) |
CommandHistory (@NotNull final String ident) | |
String | down () |
String | last (final int index) |
String | up () |
Private Member Functions | |
void | removeCommand (@NotNull final String command) |
void | trimToMaxSize () |
Private Attributes | |
int | commandIndex |
final List< String > | commands = new ArrayList<>(HISTORY_SIZE) |
Static Private Attributes | |
static final int | HISTORY_SIZE = 100 |
Manages a list of previously entered commands.
Definition at line 35 of file CommandHistory.java.
com.realtime.crossfire.jxclient.settings.CommandHistory.CommandHistory | ( | @NotNull final String | ident | ) |
Creates a new instance.
ident | the identification string for backing up to file |
Definition at line 57 of file CommandHistory.java.
void com.realtime.crossfire.jxclient.settings.CommandHistory.addCommand | ( | @NotNull final String | command | ) |
Adds a new command.
command | the command to add |
Definition at line 64 of file CommandHistory.java.
References com.realtime.crossfire.jxclient.settings.CommandHistory.commandIndex, com.realtime.crossfire.jxclient.settings.CommandHistory.commands, com.realtime.crossfire.jxclient.settings.CommandHistory.removeCommand(), and com.realtime.crossfire.jxclient.settings.CommandHistory.trimToMaxSize().
Referenced by com.realtime.crossfire.jxclient.gui.textinput.GUIText.keyPressed().
String com.realtime.crossfire.jxclient.settings.CommandHistory.down | ( | ) |
Returns the next command.
Definition at line 118 of file CommandHistory.java.
References com.realtime.crossfire.jxclient.settings.CommandHistory.commandIndex, and com.realtime.crossfire.jxclient.settings.CommandHistory.commands.
Referenced by com.realtime.crossfire.jxclient.gui.textinput.GUIText.historyNext().
String com.realtime.crossfire.jxclient.settings.CommandHistory.last | ( | final int | index | ) |
Returns the last executed command.
index | the index of the command; 0=last command, 1=second to last, etc. |
Definition at line 132 of file CommandHistory.java.
References com.realtime.crossfire.jxclient.settings.CommandHistory.commands.
Referenced by com.realtime.crossfire.jxclient.commands.AgainCommand.execute().
|
private |
Removes a command.
command | the command to remove |
Definition at line 92 of file CommandHistory.java.
References com.realtime.crossfire.jxclient.settings.CommandHistory.commands.
Referenced by com.realtime.crossfire.jxclient.settings.CommandHistory.addCommand().
|
private |
Cut off old entries if more than HISTORY_SIZE commands are present.
Definition at line 79 of file CommandHistory.java.
References com.realtime.crossfire.jxclient.settings.CommandHistory.commandIndex, com.realtime.crossfire.jxclient.settings.CommandHistory.commands, and com.realtime.crossfire.jxclient.settings.CommandHistory.HISTORY_SIZE.
Referenced by com.realtime.crossfire.jxclient.settings.CommandHistory.addCommand().
String com.realtime.crossfire.jxclient.settings.CommandHistory.up | ( | ) |
Returns the previous command.
Definition at line 109 of file CommandHistory.java.
References com.realtime.crossfire.jxclient.settings.CommandHistory.commandIndex, and com.realtime.crossfire.jxclient.settings.CommandHistory.commands.
Referenced by com.realtime.crossfire.jxclient.gui.textinput.GUIText.historyPrev().
|
private |
The current command index.
Definition at line 51 of file CommandHistory.java.
Referenced by com.realtime.crossfire.jxclient.settings.CommandHistory.addCommand(), com.realtime.crossfire.jxclient.settings.CommandHistory.down(), com.realtime.crossfire.jxclient.settings.CommandHistory.trimToMaxSize(), and com.realtime.crossfire.jxclient.settings.CommandHistory.up().
|
private |
The commands.
Definition at line 46 of file CommandHistory.java.
Referenced by com.realtime.crossfire.jxclient.settings.CommandHistory.addCommand(), com.realtime.crossfire.jxclient.settings.CommandHistory.down(), com.realtime.crossfire.jxclient.settings.CommandHistory.last(), com.realtime.crossfire.jxclient.settings.CommandHistory.removeCommand(), com.realtime.crossfire.jxclient.settings.CommandHistory.trimToMaxSize(), and com.realtime.crossfire.jxclient.settings.CommandHistory.up().
|
staticprivate |
The maximum number of commands to store.
Definition at line 40 of file CommandHistory.java.
Referenced by com.realtime.crossfire.jxclient.settings.CommandHistory.trimToMaxSize().