private int compareTemplates(@NotNull File file1,@NotNull File file2){
  TemplateMetadata template1=getTemplateMetadata(file1);
  TemplateMetadata template2=getTemplateMetadata(file2);
  if (template1 == null) {
    return 1;
  }
 else   if (template2 == null) {
    return -1;
  }
 else {
    int delta=template2.getRevision() - template1.getRevision();
    if (delta == 0) {
      delta=(int)(file2.lastModified() - file1.lastModified());
    }
    return delta;
  }
}

private int compareTemplates ( @ NotNull File file1 , @ NotNull File file2 ) { TemplateMetadata template1 = getTemplateMetadata ( file1 ) ; TemplateMetadata template2 = getTemplateMetadata ( file2 ) ; if ( template1 == null ) { return 1 ; } else if ( template2 == null ) { return - 1 ; } else { int delta = template2 . getRevision ( ) - template1 . getRevision ( ) ; if ( delta == 0 ) { delta = ( int ) ( file2 . lastModified ( ) - file1 . lastModified ( ) ) ; } return delta ; } }
compare two files , and return the one with the highest revision , and if the same , most recently modified
