Fix PropertyBindings bugs
This commit is contained in:
parent
41bb712dc6
commit
ec4ddf40c4
|
@ -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) {
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue