mirror of
https://github.com/mitb-archive/filebot
synced 2025-01-10 21:38:04 -05:00
* avoid calls to File.length() if possible
This commit is contained in:
parent
6d8c82df90
commit
b109e54db4
@ -61,6 +61,13 @@ class MatchAction extends AbstractAction {
|
||||
// 1. pass: match by file length (fast, but only works when matching torrents or files)
|
||||
metrics[0] = new LengthEqualsMetric() {
|
||||
|
||||
@Override
|
||||
public float getSimilarity(Object o1, Object o2) {
|
||||
// order of arguments is logically irrelevant, but we might be able to save us a call to File.length() this way
|
||||
return o1 instanceof File ? super.getSimilarity(o2, o1) : super.getSimilarity(o1, o2);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected long getLength(Object object) {
|
||||
if (object instanceof AbstractFile) {
|
||||
|
Loading…
Reference in New Issue
Block a user