Package net.minheur.potoflux.terminal
Class CommandHistorySaver
java.lang.Object
net.minheur.potoflux.terminal.CommandHistorySaver
Store, handle and save the command history
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionget()Getter for the entire historystatic voidLoad all history from another list, after clearing all existing commands.static voidSave a command to the history.
If the command is already the lastest, do nothing.
Inserts the command in the first position, then if the history is already full, remove the last command.
-
Field Details
-
MAX_SIZE
public static final int MAX_SIZEHistory length. There is no more commands stored as this number.- See Also:
-
-
Constructor Details
-
CommandHistorySaver
public CommandHistorySaver()
-
-
Method Details
-
save
Save a command to the history.
If the command is already the lastest, do nothing.
Inserts the command in the first position, then if the history is already full, remove the last command.- Parameters:
command- to store in the history
-
get
Getter for the entire history- Returns:
history
-
loadFrom
Load all history from another list, after clearing all existing commands.- Parameters:
pHistory- list to load from
-