* improved matching / mismatch highlighting

This commit is contained in:
Reinhard Pointner 2011-11-27 15:41:42 +00:00
parent 7a69d46f09
commit c033fa565c
3 changed files with 6 additions and 6 deletions

View File

@ -43,10 +43,10 @@ public enum EpisodeMetrics implements SimilarityMetric {
Episode episode = (Episode) object;
// get SxE from episode, both SxE for season/episode numbering and SxE for absolute episode numbering
SxE seasonEpisode = new SxE(episode.getSeason(), episode.getEpisode());
SxE absoluteEpisode = new SxE(null, episode.getAbsolute());
SxE sxe = new SxE(episode.getSeason(), episode.getEpisode());
SxE abs = new SxE(null, episode.getAbsolute());
result = seasonEpisode.equals(absoluteEpisode) ? singleton(absoluteEpisode) : asList(seasonEpisode, absoluteEpisode);
result = (abs.episode < 0 || sxe.equals(abs)) ? singleton(sxe) : asList(sxe, abs);
} else {
result = super.parse(object);
}

View File

@ -26,12 +26,12 @@ public class SeasonEpisodeMetric implements SimilarityMetric {
float similarity = -1;
for (SxE sxe1 : sxeVector1) {
for (SxE sxe2 : sxeVector2) {
if (sxe1.season >= 0 && sxe1.season == sxe2.season && sxe1.episode >= 0 && sxe1.episode == sxe2.episode) {
if (sxe1.season == sxe2.season && sxe1.episode == sxe2.episode) {
// vectors have at least one perfect episode match in common
return 1;
}
if ((sxe1.season >= 0 && sxe1.season == sxe2.season) || (sxe1.episode >= 0 && sxe1.episode == sxe2.episode)) {
if (sxe1.season == sxe2.season || sxe1.episode == sxe2.episode) {
// at least we have a partial match
similarity = 0.5f;
}

View File

@ -112,7 +112,7 @@ class RenameListCellRenderer extends DefaultFancyListCellRenderer {
if (formattedFuture.isComplexFormat()) {
typeRenderer.setVisible(true);
typeRenderer.setAlpha(1.0f);
typeRenderer.setText(formattedFuture.preview());
typeRenderer.setText(formattedFuture.getMatch().getValue().toString());
}
}