public int [ ] columnMapping ( String [ ] features ) { int [ ] map = new int [ _colNames . length ] ; for ( int i = 0 ; i < _colNames . length ; i ++ ) { map [ i ] = - 1 ; // Assume it is missing for ( int j = 0 ; j < features . length ; j ++ ) { if ( _colNames [ i ] . equals ( features [ j ] ) ) { if ( map [ i ] != - 1 ) throw new IllegalArgumentException ( "duplicate feature " + _colNames [ i ] ) ; map [ i ] = j ; } } if ( map [ i ] == - 1 ) Log . warn ( Sys . SCORM , "Model feature " + _colNames [ i ] + " not in the provided feature list from the data" ) ; } return map ; }
needs then this map will contain a - 1 for the missing feature index .