protected int getIndexFromMap ( int [ ] maskMap , int index ) { if ( index < 0 || index >= maskMap . length ) throw new IndexOutOfBoundsException ( "The given index is beyond the bounds of the matrix" ) ; int newIndex = maskMap [ index ] ; if ( newIndex < 0 || maskMap == rowMaskMap && newIndex >= matrix . rows ( ) || maskMap == colMaskMap && newIndex >= matrix . columns ( ) ) throw new IndexOutOfBoundsException ( "The mapped index is beyond the bounds of the base matrix" ) ; return newIndex ; }
Returns the new index value for a given index from a given mapping . Returns - 1 if no mapping is found for the requested row .