|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rice.cs.drjava.model.repl.History
public class History
History class that records what has been typed in the interactions pane. This class is not thread safe; it is only accessed from InteractionsDocument which takes responsibility for synchronization.
| Nested Class Summary |
|---|
| Field Summary | |
|---|---|
private String |
_currentSearchString
A placeholder for the current search string. |
private int |
_cursor
|
private HashMap<Integer,String> |
_editedEntries
A hashmap for edited entries in the history. |
private int |
_maxSize
|
private ArrayList<String> |
_vector
|
static String |
HISTORY_FORMAT_VERSION_2
Version flag at the beginning of saved history file format If this is not present in a saved history, it is assumed to be the original format. |
OptionListener<Integer> |
historyOptionListener
The OptionListener for HISTORY_MAX_SIZE |
static String |
INTERACTION_SEPARATOR
|
| Constructor Summary | |
|---|---|
History()
Constructor, so we can add a listener to the Config item being used. |
|
History(int maxSize)
Creates a new History with the given size. |
|
| Method Summary | |
|---|---|
void |
add(String item)
Adds an item to the history and moves the cursor to point to the place after it. |
void |
clear()
Clears the vector |
void |
forwardSearch(String currentInteraction)
Forward-searches the history for the next matching string. |
String |
getCurrent()
Returns item in history at current position; returns "" if no current item exists. |
String |
getHistoryAsString()
Returns the history as a string by concatenating the lines in _vector with EOL as separator. |
String |
getHistoryAsStringWithSemicolons()
Returns the history as a string by concatenating each string in the vector separated by the delimiting character. |
OptionListener<Integer> |
getHistoryOptionListener()
|
boolean |
hasNext()
Returns whether moveNext() would succeed right now. |
boolean |
hasPrevious()
Returns whether movePrevious() would succeed right now. |
String |
lastEntry()
Returns the last entry from the history. |
void |
moveEnd()
Move the cursor to just past the end. |
void |
moveNext(String entry)
Moves cursor forward 1, or throws exception if there is none. |
void |
movePrevious(String entry)
Moves cursor back 1, or throws exception if there is none. |
String |
removeLast()
Returns the last element and removes it, or returns null if the history is empty. |
void |
reverseSearch(String currentInteraction)
Reverse-searches the history for the previous matching string. |
void |
setEditedEntry(String entry)
Sets the edited entry to the given value. |
void |
setMaxSize(int newSize)
Changes the maximum number of interactions remembered by this History. |
int |
size()
Returns the number of items in this History. |
void |
writeToFile(FileSaveSelector selector)
Writes this (unedited) History to the file selected in the FileSaveSelector. |
static void |
writeToFile(FileSaveSelector selector,
String editedVersion)
Writes this History to the file selected in the FileSaveSelector. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String INTERACTION_SEPARATOR
private volatile int _maxSize
public static final String HISTORY_FORMAT_VERSION_2
private final ArrayList<String> _vector
private volatile int _cursor
private final HashMap<Integer,String> _editedEntries
private volatile String _currentSearchString
public final OptionListener<Integer> historyOptionListener
| Constructor Detail |
|---|
public History()
public History(int maxSize)
maxSize - Number of lines to remember in the history.| Method Detail |
|---|
public OptionListener<Integer> getHistoryOptionListener()
public void setEditedEntry(String entry)
entry - the string to setpublic void add(String item)
public String removeLast()
public void moveEnd()
public void movePrevious(String entry)
entry - the current entry (perhaps edited from what is in history)public String lastEntry()
public void moveNext(String entry)
entry - the current entry (perhaps edited from what is in history)public boolean hasNext()
public boolean hasPrevious()
public String getCurrent()
public int size()
public void clear()
public String getHistoryAsStringWithSemicolons()
public String getHistoryAsString()
public void writeToFile(FileSaveSelector selector)
throws IOException
selector - File to save to
IOException
public static void writeToFile(FileSaveSelector selector,
String editedVersion)
throws IOException
selector - File to save toeditedVersion - The edited version of the text to be saved (which already uses proper EOL string)
IOExceptionpublic void setMaxSize(int newSize)
newSize - New number of interactions to remember.public void reverseSearch(String currentInteraction)
currentInteraction - the current interactionpublic void forwardSearch(String currentInteraction)
currentInteraction - the current interaction
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||