public int get ( int index ) throws NoSuchElementException { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "get" ) ; int retValue = 0 ; // We need to work out which array this item will be in int arrayNumber = index / arraySize ; // Bounds check if ( ( index + 1 ) > elements ) { throw new NoSuchElementException ( ) ; } else if ( index < 0 ) { throw new NoSuchElementException ( ) ; } // Is it in the current array? else if ( allArrays . size ( ) == arrayNumber ) { retValue = current [ index - ( arrayNumber * arraySize ) ] ; } // Else get the array from the Vector and // return the value else { int [ ] tempArray = ( int [ ] ) allArrays . get ( arrayNumber ) ; retValue = tempArray [ index - ( arrayNumber * arraySize ) ] ; } if ( tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "rc=" , retValue ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "get" ) ; return retValue ; }
Gets an int from the array .