Package org.basex.util
Class History
java.lang.Object
org.basex.util.History
This class stores strings in a history.
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanactive()Indicates if the history is active.intcaret()Returns the caret position.booleanfirst()Checks if the history points to the first entry.voidinit(byte[] text) Initializes the history with a text.booleanlast()Checks if the history points to the last entry.booleanmodified()Checks if the file has been modified.byte[]next()Returns the next string and increases the pointer, or returnsnull.byte[]prev()Returns the previous string and decreases the pointer, or returnsnull.voidsave()Sets the saved position.voidstore(byte[] str, int oc, int nc) Stores a string in the history.
-
Constructor Details
-
History
public History(byte[] text) Constructor.- Parameters:
text- initial text
-
-
Method Details
-
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 returnsnull.- Returns:
- previous string or
null
-
next
public byte[] next()Returns the next string and increases the pointer, or returnsnull.- 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 storedoc- old caret positionnc- 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
-