commit | afbb259a137d129b587596858531c56ac75c1bd3 | [log] [tgz] |
---|---|---|
author | margaretha <margaretha@ids-mannheim.de> | Wed Nov 11 14:50:30 2015 +0100 |
committer | margaretha <margaretha@ids-mannheim.de> | Wed Nov 11 14:50:30 2015 +0100 |
tree | 05614a93cdbd9f937496cd889fe4188f4b40a99a | |
parent | a70018fed583e534f6c6e47fbf00b8060ce93b19 [diff] |
Updated cost (fixed the bug). Change-Id: I3b986edbc9a8506ec4b4e84464df697d5dcfb371
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/TokenDistanceSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/TokenDistanceSpans.java index 7eb0dfc..e4b5d1b 100644 --- a/src/main/java/de/ids_mannheim/korap/query/spans/TokenDistanceSpans.java +++ b/src/main/java/de/ids_mannheim/korap/query/spans/TokenDistanceSpans.java
@@ -125,8 +125,15 @@ @Override public long cost () { - CandidateSpan candidateSpan = candidateList.get(candidateListIndex); - return candidateSpan.getCost() + secondSpans.cost(); + if (candidateList.size() > 0) { + long cost = 0; + for (CandidateSpan candidateSpan : candidateList) { + cost += candidateSpan.getCost(); + } + return cost + secondSpans.cost(); + } else { + return firstSpans.cost() + secondSpans.cost(); + } }