private static PortablePosition navigateToPathTokenWithAnyQuantifierInPrimitiveArray ( PortableNavigatorContext ctx , PortablePathCursor path , NavigationFrame frame ) throws IOException { // if no frame, we're pursuing the cell[0] case and populating the frames for cell[1 to length-1] if ( frame == null ) { if ( path . isLastToken ( ) ) { // first we check if array null or empty int len = getArrayLengthOfTheField ( ctx ) ; PortablePosition result = doValidateArrayLengthForAnyQuantifier ( len , path . isLastToken ( ) ) ; if ( result != null ) { return result ; } // then we populate frames for cell[1 to length-1] ctx . populateAnyNavigationFrames ( path . index ( ) , len ) ; // finally, we return the cell's position for reading -> cell[0] return createPositionForReadAccess ( ctx , path , 0 ) ; } // primitive array cell has to be a last token, there's no furhter navigation from there. throw createWrongUseOfAnyOperationException ( ctx , path . path ( ) ) ; } else { if ( path . isLastToken ( ) ) { return createPositionForReadAccess ( ctx , path , frame . arrayIndex ) ; } throw createWrongUseOfAnyOperationException ( ctx , path . path ( ) ) ; } }
navigation in PRIMITIVE array