public boolean absolute ( int row ) throws PersistenceBrokerException { // 1. handle the special cases first. if ( row == 0 ) { return true ; } if ( row == 1 ) { m_activeIteratorIndex = 0 ; m_activeIterator = ( OJBIterator ) m_rsIterators . get ( m_activeIteratorIndex ) ; m_activeIterator . absolute ( 1 ) ; return true ; } if ( row == - 1 ) { m_activeIteratorIndex = m_rsIterators . size ( ) ; m_activeIterator = ( OJBIterator ) m_rsIterators . get ( m_activeIteratorIndex ) ; m_activeIterator . absolute ( - 1 ) ; return true ; } // now do the real work. boolean movedToAbsolute = false ; boolean retval = false ; setNextIterator ( ) ; // row is positive, so index from beginning. if ( row > 0 ) { int sizeCount = 0 ; Iterator it = m_rsIterators . iterator ( ) ; OJBIterator temp = null ; while ( it . hasNext ( ) && ! movedToAbsolute ) { temp = ( OJBIterator ) it . next ( ) ; if ( temp . size ( ) < row ) { sizeCount += temp . size ( ) ; } else { // move to the offset - sizecount m_currentCursorPosition = row - sizeCount ; retval = temp . absolute ( m_currentCursorPosition ) ; movedToAbsolute = true ; } } } // row is negative, so index from end else if ( row < 0 ) { int sizeCount = 0 ; OJBIterator temp = null ; for ( int i = m_rsIterators . size ( ) ; ( ( i >= 0 ) && ! movedToAbsolute ) ; i -- ) { temp = ( OJBIterator ) m_rsIterators . get ( i ) ; if ( temp . size ( ) < row ) { sizeCount += temp . size ( ) ; } else { // move to the offset - sizecount m_currentCursorPosition = row + sizeCount ; retval = temp . absolute ( m_currentCursorPosition ) ; movedToAbsolute = true ; } } } return retval ; }
the absolute and relative calls are the trickiest parts . We have to move across cursor boundaries potentially .