mirror of
https://github.com/mitb-archive/filebot
synced 2025-01-14 15:28:03 -05:00
25 lines
481 B
Java
25 lines
481 B
Java
package net.filebot.similarity;
|
|
|
|
public class MetricAvg implements SimilarityMetric {
|
|
|
|
private final SimilarityMetric[] metrics;
|
|
|
|
public MetricAvg(SimilarityMetric... metrics) {
|
|
this.metrics = metrics;
|
|
}
|
|
|
|
public SimilarityMetric[] getMetrics() {
|
|
return metrics.clone();
|
|
}
|
|
|
|
@Override
|
|
public float getSimilarity(Object o1, Object o2) {
|
|
float f = 0;
|
|
for (SimilarityMetric metric : metrics) {
|
|
f += metric.getSimilarity(o1, o2);
|
|
}
|
|
return f / metrics.length;
|
|
}
|
|
|
|
}
|