Crossfire JXClient, Trunk
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
com.realtime.crossfire.jxclient.settings.CommandHistory Class Reference
Collaboration diagram for com.realtime.crossfire.jxclient.settings.CommandHistory:
Collaboration graph

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
 

Detailed Description

Manages a list of previously entered commands.

Author
Andreas Kirschbaum

Definition at line 35 of file CommandHistory.java.

Constructor & Destructor Documentation

◆ CommandHistory()

com.realtime.crossfire.jxclient.settings.CommandHistory.CommandHistory ( @NotNull final String  ident)

Creates a new instance.

Parameters
identthe identification string for backing up to file

Definition at line 57 of file CommandHistory.java.

Member Function Documentation

◆ addCommand()

void com.realtime.crossfire.jxclient.settings.CommandHistory.addCommand ( @NotNull final String  command)

◆ down()

String com.realtime.crossfire.jxclient.settings.CommandHistory.down ( )

Returns the next command.

Returns
the next command or
null
if no previous command exists

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().

Here is the caller graph for this function:

◆ last()

String com.realtime.crossfire.jxclient.settings.CommandHistory.last ( final int  index)

Returns the last executed command.

Parameters
indexthe index of the command; 0=last command, 1=second to last, etc.
Returns
the last executed command or
null
if the index is invalid

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().

Here is the caller graph for this function:

◆ removeCommand()

void com.realtime.crossfire.jxclient.settings.CommandHistory.removeCommand ( @NotNull final String  command)
private

Removes a command.

Parameters
commandthe 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().

Here is the caller graph for this function:

◆ trimToMaxSize()

void com.realtime.crossfire.jxclient.settings.CommandHistory.trimToMaxSize ( )
private

◆ up()

String com.realtime.crossfire.jxclient.settings.CommandHistory.up ( )

Returns the previous command.

Returns
the previous command or
null
if no previous command exists

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().

Here is the caller graph for this function:

Member Data Documentation

◆ commandIndex

int com.realtime.crossfire.jxclient.settings.CommandHistory.commandIndex
private

◆ commands

final List<String> com.realtime.crossfire.jxclient.settings.CommandHistory.commands = new ArrayList<>(HISTORY_SIZE)
private

◆ HISTORY_SIZE

final int com.realtime.crossfire.jxclient.settings.CommandHistory.HISTORY_SIZE = 100
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().


The documentation for this class was generated from the following file: