Interface HistoryManager

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addEntry​(java.lang.String newEntry)
      Add a line or a block in history
      void display()
      Display all history entries with line numbers
      java.lang.String getEntry​(int entryIndex)
      Gets an entry in the history by giving its number
      java.lang.String getNextEntry​(java.lang.String beg)
      Gets next entry in the history by giving its beginning
      java.lang.String getPreviousEntry​(java.lang.String beg)
      Gets previous entry in the history by giving its beginning
      java.lang.String getTmpEntry()
      Gets the currently edited command line before erasing it
      boolean isInHistory()
      Are we browsing history ?
      void load()
      Load history from a file
      void reset()
      Clears the history
      void save()
      Save history to a file
      void setInHistory​(boolean status)
      Sets the flag indicating if we are browsing history
      void setMaxEntryNumber​(int numberOfEntries)
      Set the maximum number of entries (lines/blocks) allowed in the history
      void setTmpEntry​(java.lang.String currentCommandLine)
      Saves the currently edited command line before erasing it
    • Method Detail

      • addEntry

        void addEntry​(java.lang.String newEntry)
        Add a line or a block in history
        Parameters:
        newEntry - the entry to be added at the end of the history
      • display

        void display()
        Display all history entries with line numbers
      • setMaxEntryNumber

        void setMaxEntryNumber​(int numberOfEntries)
        Set the maximum number of entries (lines/blocks) allowed in the history
        Parameters:
        numberOfEntries - the number of entries to set
      • reset

        void reset()
        Clears the history
      • load

        void load()
        Load history from a file
      • save

        void save()
        Save history to a file
      • getEntry

        java.lang.String getEntry​(int entryIndex)
        Gets an entry in the history by giving its number
        Parameters:
        entryIndex - the index of the entry in the history
        Returns:
        the entry
      • getPreviousEntry

        java.lang.String getPreviousEntry​(java.lang.String beg)
        Gets previous entry in the history by giving its beginning
        Parameters:
        beg - the beginning of the entry (can be empty)
        Returns:
        the entry
      • getNextEntry

        java.lang.String getNextEntry​(java.lang.String beg)
        Gets next entry in the history by giving its beginning
        Parameters:
        beg - the beginning of the entry (can be empty)
        Returns:
        the entry
      • setTmpEntry

        void setTmpEntry​(java.lang.String currentCommandLine)
        Saves the currently edited command line before erasing it
        Parameters:
        currentCommandLine - the text currently edited by the user
      • getTmpEntry

        java.lang.String getTmpEntry()
        Gets the currently edited command line before erasing it
        Returns:
        the text currently edited by the user before going into history
      • isInHistory

        boolean isInHistory()
        Are we browsing history ?
        Returns:
        true if we are browing history, false else
      • setInHistory

        void setInHistory​(boolean status)
        Sets the flag indicating if we are browsing history
        Parameters:
        status - is true if we begin to browse the history, false if we stop browsing