public class History extends Object
The GNU Lesser General Public License for details.| Modifier and Type | Field and Description | 
|---|---|
private int | 
backCount
The number of elements in the "back" list. 
 | 
private Map<Object,Long> | 
history
A map of elements that have been seen so far to when they have been seen. 
 | 
private List<HistoryListener> | 
listeners
Listeners that are interested when history has changed. 
 | 
private List<Object> | 
nav
The elements that can be navigated. 
 | 
| Constructor and Description | 
|---|
History()
Create an empty navigation and history list. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
add(Object obj)
Add an element to history. 
 | 
void | 
addHistoryListener(HistoryListener li)
Add a listener for history events. 
 | 
private void | 
fireHistoryChanged()
Kick of an event sequence 
 | 
Object | 
getCurrent()
Get the current item in the "back" list 
 | 
List<Object> | 
getNextList()
Get all the elements in the "forward" list. 
 | 
List<Object> | 
getPreviousList()
Get all the elements in "back" list. 
 | 
Object | 
go(int i)
Increments the current history item by the given amount. 
 | 
private Object | 
peek(int i)
Get the current item in the "back" list 
 | 
void | 
removeHistoryListener(HistoryListener li)
Remove a listener of history events. 
 | 
Object | 
select(int index)
Make a particular element in the navigation list the current item in
 history. 
 | 
private void | 
visit(Object obj)
Note that this object has been seen at this time. 
 | 
private Map<Object,Long> history
private int backCount
private List<HistoryListener> listeners
public Object select(int index)
index - the index of item to make the last one in the back list, -1
            (or lower) will put everything in the forward list. Indexes
            beyond the end of the list will put everything in the back
            list.public void add(Object obj)
obj - the object to addpublic List<Object> getPreviousList()
public List<Object> getNextList()
public Object go(int i)
i - the distance to travelpublic Object getCurrent()
private Object peek(int i)
i - the distance to travelpublic void addHistoryListener(HistoryListener li)
li - the interested listenerpublic void removeHistoryListener(HistoryListener li)
li - the disinterested listenerprivate void visit(Object obj)
obj - the object that has been seenprivate void fireHistoryChanged()