@Test public void areEqualTranslit() { assertTrue(comparator.areEqual( new Movie("Остров сокровищ", 1988), new Movie("Ostrov sokrovishch", 1988) )); assertTrue(comparator.areEqual( new Movie("Белый Бим Черное ухо", 1976), new Movie("Belyy Bim Chernoe ukho", 1976) )); assertTrue(comparator.areEqual( new Movie("Шерлок Холмс и доктор Ватсон: Знакомство", 1979), new Movie("Sherlok Kholms i doktor Vatson: Znakomstvo", 1979) )); }
@Override public boolean areEqual(@NonNull Movie movie1, @NonNull Movie movie2) { val title1 = movie1.getTitle(); val title2 = movie2.getTitle(); for (StringModifier m1 : modifiers) { for (StringModifier m2 : modifiers) { boolean result = m1.modify(title1).equalsIgnoreCase(m2.modify(title2)); if (result) { LOG.debug("Found match when comparing title '{}' with title '{}'", title1, title2); return true; } } } LOG.debug("No matches found when comparing title '{}' with title '{}'!", title1, title2); return false; }
SmartTitleComparator extends AbstractMovieComparator { @Override public boolean areEqual(@NonNull Movie movie1, @NonNull Movie movie2) { val title1 = movie1.getTitle(); val title2 = movie2.getTitle(); for (StringModifier m1 : modifiers) { for (StringModifier m2 : modifiers) { boolean result = m1.modify(title1).equalsIgnoreCase(m2.modify(title2)); if (result) { LOG.debug("Found match when comparing title '{}' with title '{}'", title1, title2); return true; } } } LOG.debug("No matches found when comparing title '{}' with title '{}'!", title1, title2); return false; } }
SmartTitleComparator extends AbstractMovieComparator { @Override public boolean areEqual(@NonNull Movie movie1, @NonNull Movie movie2) { val title1 = movie1.getTitle(); val title2 = movie2.getTitle(); for (StringModifier m1 : modifiers) { for (StringModifier m2 : modifiers) { boolean result = m1.modify(title1).equalsIgnoreCase(m2.modify(title2)); if (result) { LOG.debug("Found match when comparing title '{}' with title '{}'", title1, title2); return true; } } } LOG.debug("No matches found when comparing title '{}' with title '{}'!", title1, title2); return false; }  }
SmartTitleComparator extends AbstractMovieComparator { @Override public boolean areEqual(@NonNull Movie movie1, @NonNull Movie movie2) { val title1 = movie1.getTitle(); val title2 = movie2.getTitle(); for (StringModifier m1 : modifiers) { for (StringModifier m2 : modifiers) { boolean result = m1.modify(title1).equalsIgnoreCase(m2.modify(title2)); if (result) { LOG.debug("Found match when comparing title '{}' with title '{}'", title1, title2); return true; } } } LOG.debug("No matches found when comparing title '{}' with title '{}'!", title1, title2); return false; }  @Override boolean areEqual(@NonNull Movie movie1, @NonNull Movie movie2); }
SmartTitleComparator extends AbstractMovieComparator { @Override public boolean areEqual(@NonNull Movie movie1, @NonNull Movie movie2) { val title1 = movie1.getTitle(); val title2 = movie2.getTitle(); for (StringModifier m1 : modifiers) { for (StringModifier m2 : modifiers) { boolean result = m1.modify(title1).equalsIgnoreCase(m2.modify(title2)); if (result) { LOG.debug("Found match when comparing title '{}' with title '{}'", title1, title2); return true; } } } LOG.debug("No matches found when comparing title '{}' with title '{}'!", title1, title2); return false; }  @Override boolean areEqual(@NonNull Movie movie1, @NonNull Movie movie2);  }