Horus Doc || Java GUI Reference || Doxygen's quick Index  

HistoryList Class Reference

List of all members.

Public Methods

 HistoryList ()
void add (String in)
String getPrevious ()
String getNext ()

Constructor & Destructor Documentation

HistoryList::HistoryList   [inline]
 

00022 {
00023     _list = new Vector();
00024     _pos = -1;
00025     _sel = null;
00026 }


Member Function Documentation

void HistoryList::add String    in [inline]
 

00030 {
00031     if(in.length() > 0) {
00032         String last = (_list.size() > 0)? ""+_list.lastElement() : null;
00033         if(!in.equals(last))
00034             _list.add(in);
00035     }
00036 
00037     if(!in.equals(_sel)) // a new one
00038         _pos = _list.size()-1;
00039 
00040     _sel = null;
00041 }

String HistoryList::getPrevious   [inline]
 

00044 {
00045     if(_list.size() == 0) return null;
00046 
00047     //decrement pos unless it is the first time (_sel == nul)
00048     if((_sel != null) && (_pos > 0)) _pos--;
00049 
00050     _sel = _list.elementAt(_pos).toString();
00051     return _sel;
00052 }

String HistoryList::getNext   [inline]
 

00055 {
00056     if(_list.size() == 0) return null;
00057 
00058     if(_pos < _list.size() - 1) _pos++;
00059 
00060     _sel = _list.elementAt(_pos).toString();
00061     return _sel;
00062 }


The documentation for this class was generated from the following file:
Generated on Mon Jan 27 15:11:19 2003 for JavaReference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001