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

TimeSpanList Class Reference

List of all members.

Public Methods

 TimeSpanList (HxCorba.VxTimeSpan[] d)
int searchSegmentOfFrame (int frameNr)

Constructor & Destructor Documentation

TimeSpanList::TimeSpanList HxCorba.VxTimeSpan    d[] [inline]
 

00019 {
00020     _timeSpans = d;
00021     _lastPos = -1;
00022 }


Member Function Documentation

int TimeSpanList::searchSegmentOfFrame int    frameNr [inline]
 

00025 {
00026     if(_lastPos < 0) _lastPos = 0;
00027     if(_lastPos >= _timeSpans.length) _lastPos = _timeSpans.length - 1;
00028 
00029     int start = _timeSpans[_lastPos].start;
00030     int end = _timeSpans[_lastPos].end;
00031 
00032     if(frameNr > end) { // search forwards
00033         _lastPos++;
00034         while(_lastPos < _timeSpans.length) {
00035             start = _timeSpans[_lastPos].start;
00036             end = _timeSpans[_lastPos].end;
00037             if(frameNr <= end) {
00038                 if(frameNr >= start) return _lastPos; // here it is
00039                 else return -1; // frameNr is in a gap
00040             }
00041             _lastPos++;
00042         }
00043         return -1; // reached the end
00044     }
00045     else if(frameNr < start) { //search backwards
00046         _lastPos--;
00047         while(_lastPos >= 0) {
00048             start = _timeSpans[_lastPos].start;
00049             end = _timeSpans[_lastPos].end;
00050             if(frameNr >= start) {
00051                 if(frameNr <= end) return _lastPos; // here it is
00052                 else return -1; // pos is in a gap
00053             }
00054             _lastPos--;
00055         }
00056         return -1; // reached the begining
00057     }
00058     else
00059         return _lastPos;
00060 }


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