Class CommandHistory


  • public class CommandHistory
    extends java.lang.Object
    Manages a list of previously entered commands.
    • Constructor Summary

      Constructors 
      Constructor Description
      CommandHistory​(@NotNull java.lang.String ident)
      Creates a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addCommand​(@NotNull java.lang.String command)
      Adds a new command.
      @Nullable java.lang.String down()
      Returns the next command.
      @Nullable java.lang.CharSequence last​(int index)
      Returns the last executed command.
      @Nullable 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
    • Constructor Detail

      • CommandHistory

        public CommandHistory​(@NotNull
                              @NotNull java.lang.String ident)
        Creates a new instance.
        Parameters:
        ident - the identification string for backing up to file
    • Method Detail

      • addCommand

        public void addCommand​(@NotNull
                               @NotNull java.lang.String command)
        Adds a new command.
        Parameters:
        command - the command to add
      • up

        @Nullable
        public @Nullable java.lang.String up()
        Returns the previous command.
        Returns:
        the previous command or null if no previous command exists
      • down

        @Nullable
        public @Nullable java.lang.String down()
        Returns the next command.
        Returns:
        the next command or null if no previous command exists
      • last

        @Nullable
        public @Nullable java.lang.CharSequence last​(int index)
        Returns the last executed command.
        Parameters:
        index - the index of the command; 0=last command, 1=second to last, etc.
        Returns:
        the last executed command or null if the index is invalid