1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-11 20:05:04 -05:00

Fix PropertyBindings bugs

This commit is contained in:
Reinhard Pointner 2017-06-05 15:21:34 +08:00
parent 41bb712dc6
commit ec4ddf40c4
2 changed files with 2 additions and 8 deletions

View File

@ -1245,7 +1245,7 @@ public class MediaBindingBean {
} }
private AssociativeScriptObject createPropertyBindings(Object object) { private AssociativeScriptObject createPropertyBindings(Object object) {
return new AssociativeScriptObject(new PropertyBindings(object, null)) { return new AssociativeScriptObject(new PropertyBindings(object)) {
@Override @Override
public Object getProperty(String name) { public Object getProperty(String name) {

View File

@ -1,29 +1,24 @@
package net.filebot.similarity; package net.filebot.similarity;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
import net.filebot.format.PropertyBindings; import net.filebot.format.PropertyBindings;
public class CrossPropertyMetric implements SimilarityMetric { public class CrossPropertyMetric implements SimilarityMetric {
private SimilarityMetric metric; private SimilarityMetric metric;
public CrossPropertyMetric(SimilarityMetric metric) { public CrossPropertyMetric(SimilarityMetric metric) {
this.metric = metric; this.metric = metric;
} }
public CrossPropertyMetric() { public CrossPropertyMetric() {
this.metric = new StringEqualsMetric(); this.metric = new StringEqualsMetric();
} }
@Override @Override
public float getSimilarity(Object o1, Object o2) { public float getSimilarity(Object o1, Object o2) {
Map<String, Object> m1 = getProperties(o1); Map<String, Object> m1 = getProperties(o1);
@ -53,9 +48,8 @@ public class CrossPropertyMetric implements SimilarityMetric {
return feedback / keys.size(); return feedback / keys.size();
} }
protected Map<String, Object> getProperties(Object object) { protected Map<String, Object> getProperties(Object object) {
return new PropertyBindings(object, null); return new PropertyBindings(object);
} }
} }