Class MemoryHistory
java.lang.Object
jline.console.history.MemoryHistory
- All Implemented Interfaces:
Iterable<History.Entry>, History
- Direct Known Subclasses:
FileHistory
Non-persistent
History.- Since:
- 2.3
- Author:
- Marc Prud'hommeaux, Jason Dillon
-
Nested Class Summary
Nested classes/interfaces inherited from interface History
History.Entry -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(CharSequence item) voidclear()current()Return the content of the current buffer.entries()entries(int index) get(int index) intintindex()protected voidinternalAdd(CharSequence item) booleanbooleanisEmpty()booleaniterator()booleanmoveTo(int index) Move to the specified index in the historyvoidMove to the end of the history buffer.booleanMoves the history index to the first entry.booleanThis moves the history to the last entry.booleannext()Move the pointer to the next element in the buffer.booleanprevious()Move the pointer to the previous element in the buffer.remove(int i) Remove the history element at the given index.Remove the first element from history.Remove the last element from historyvoidreplace(CharSequence item) voidset(int index, CharSequence item) Set the history item at the given index to the given CharSequence.voidsetAutoTrim(boolean flag) voidsetIgnoreDuplicates(boolean flag) voidsetMaxSize(int maxSize) intsize()toString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
DEFAULT_MAX_SIZE
public static final int DEFAULT_MAX_SIZE- See Also:
-
-
Constructor Details
-
MemoryHistory
public MemoryHistory()
-
-
Method Details
-
setMaxSize
public void setMaxSize(int maxSize) -
getMaxSize
public int getMaxSize() -
isIgnoreDuplicates
public boolean isIgnoreDuplicates() -
setIgnoreDuplicates
public void setIgnoreDuplicates(boolean flag) -
isAutoTrim
public boolean isAutoTrim() -
setAutoTrim
public void setAutoTrim(boolean flag) -
size
-
isEmpty
-
index
-
clear
-
get
-
set
Description copied from interface:HistorySet the history item at the given index to the given CharSequence. -
add
-
remove
Description copied from interface:HistoryRemove the history element at the given index. -
removeFirst
Description copied from interface:HistoryRemove the first element from history.- Specified by:
removeFirstin interfaceHistory- Returns:
- the removed element
-
removeLast
Description copied from interface:HistoryRemove the last element from history- Specified by:
removeLastin interfaceHistory- Returns:
- the removed element
-
internalAdd
-
replace
-
entries
-
entries
-
iterator
- Specified by:
iteratorin interfaceHistory- Specified by:
iteratorin interfaceIterable<History.Entry>
-
moveToLast
public boolean moveToLast()This moves the history to the last entry. This entry is one position before the moveToEnd() position.- Specified by:
moveToLastin interfaceHistory- Returns:
- Returns false if there were no history entries or the history index was already at the last entry.
-
moveTo
-
moveToFirst
public boolean moveToFirst()Moves the history index to the first entry.- Specified by:
moveToFirstin interfaceHistory- Returns:
- Return false if there are no entries in the history or if the history is already at the beginning.
-
moveToEnd
-
current
Return the content of the current buffer. -
previous
-
next
-
toString
-