protected boolean checkCitationIds ( List < String > citationIds , ItemDataProvider provider ) { for ( String id : citationIds ) { if ( provider . retrieveItem ( id ) == null ) { String message = "unknown citation id: " + id ; //find alternatives List < String > availableIds = Arrays . asList ( provider . getIds ( ) ) ; if ( ! availableIds . isEmpty ( ) ) { Collection < String > mins = Levenshtein . findSimilar ( availableIds , id ) ; if ( mins . size ( ) > 0 ) { if ( mins . size ( ) == 1 ) { message += "\n\nDid you mean this?" ; } else { message += "\n\nDid you mean one of these?" ; } for ( String m : mins ) { message += "\n\t" + m ; } } } error ( message ) ; return false ; } } return true ; }
Checks the citation IDs provided on the command line