Class History


  • public final class History
    extends Object
    This class stores strings in a history.
    Author:
    BaseX Team 2005-23, BSD License, Christian Gruen
    • Constructor Summary

      Constructors 
      Constructor Description
      History​(byte[] text)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean active()
      Indicates if the history is active.
      int caret()
      Returns the caret position.
      boolean first()
      Checks if the history points to the first entry.
      void init​(byte[] text)
      Initializes the history with a text.
      boolean last()
      Checks if the history points to the last entry.
      boolean modified()
      Checks if the file has been modified.
      byte[] next()
      Returns the next string and increases the pointer, or returns null.
      byte[] prev()
      Returns the previous string and decreases the pointer, or returns null.
      void save()
      Sets the saved position.
      void store​(byte[] str, int oc, int nc)
      Stores a string in the history.
    • Constructor Detail

      • History

        public History​(byte[] text)
        Constructor.
        Parameters:
        text - initial text
    • Method Detail

      • init

        public void init​(byte[] text)
        Initializes the history with a text.
        Parameters:
        text - initial text
      • active

        public boolean active()
        Indicates if the history is active.
        Returns:
        result of check
      • first

        public boolean first()
        Checks if the history points to the first entry.
        Returns:
        result of check
      • last

        public boolean last()
        Checks if the history points to the last entry.
        Returns:
        result of check
      • prev

        public byte[] prev()
        Returns the previous string and decreases the pointer, or returns null.
        Returns:
        previous string or null
      • next

        public byte[] next()
        Returns the next string and increases the pointer, or returns null.
        Returns:
        previous string or null
      • caret

        public int caret()
        Returns the caret position.
        Returns:
        caret position
      • store

        public void store​(byte[] str,
                          int oc,
                          int nc)
        Stores a string in the history.
        Parameters:
        str - string to be stored
        oc - old caret position
        nc - new caret position
      • save

        public void save()
        Sets the saved position.
      • modified

        public boolean modified()
        Checks if the file has been modified.
        Returns:
        result of check