private static int [ ] createMapping ( final MojoModel model , final String [ ] reference , final String modelName ) { int [ ] mapping = new int [ reference . length ] ; if ( model . _names . length != reference . length ) { throw new IllegalStateException ( String . format ( "Model '%s' is expected to have has non-standard number of columns." , modelName ) ) ; } boolean foundDifference = false ; for ( int i = 0 ; i < reference . length ; i ++ ) { final int pos = findColumnIndex ( model . _names , reference [ i ] ) ; if ( pos == - 1 ) { throw new IllegalStateException ( String . format ( "Model '%s' does not have input column '%s'" , modelName , reference [ i ] ) ) ; } if ( pos != i ) foundDifference = true ; mapping [ i ] = pos ; } if ( foundDifference ) { return mapping ; } else return null ; }
Creates an array of integers with mapping of referential column name space into model - specific column name space .