| Nils Diewald | c7b6063 | 2014-09-05 19:59:01 +0000 | [diff] [blame] | 1 | package de.ids_mannheim.korap.index; |
| 2 | import de.ids_mannheim.korap.KorapMatch; |
| Nils Diewald | c471b18 | 2014-11-19 22:51:15 +0000 | [diff] [blame] | 3 | import de.ids_mannheim.korap.response.KorapResponse; |
| Nils Diewald | 6aa929e | 2014-09-17 13:30:34 +0000 | [diff] [blame] | 4 | import java.util.*; |
| Nils Diewald | c7b6063 | 2014-09-05 19:59:01 +0000 | [diff] [blame] | 5 | |
| Nils Diewald | d723d81 | 2014-09-23 18:50:52 +0000 | [diff] [blame] | 6 | public class MatchCollector extends KorapResponse { |
| 7 | public int totalResultDocs = 0; |
| Nils Diewald | c471b18 | 2014-11-19 22:51:15 +0000 | [diff] [blame] | 8 | private int totalResults; |
| 9 | private long totalTexts; |
| Nils Diewald | d723d81 | 2014-09-23 18:50:52 +0000 | [diff] [blame] | 10 | |
| 11 | public void add (int uniqueDocID, int matchcount) { |
| 12 | this.totalResultDocs++; |
| 13 | this.incrTotalResults(matchcount); |
| 14 | }; |
| 15 | |
| 16 | public MatchCollector setTotalResultDocs (int i) { |
| 17 | this.totalResultDocs = i; |
| 18 | return this; |
| 19 | }; |
| 20 | |
| 21 | public MatchCollector incrTotalResultDocs (int i) { |
| 22 | this.totalResultDocs += i; |
| 23 | return this; |
| 24 | }; |
| 25 | |
| 26 | public int getTotalResultDocs () { |
| 27 | return totalResultDocs; |
| 28 | }; |
| 29 | |
| Nils Diewald | c471b18 | 2014-11-19 22:51:15 +0000 | [diff] [blame] | 30 | // Make this working in a KorapResult class |
| 31 | // that is independent from search and collection |
| 32 | public MatchCollector setTotalTexts (long i) { |
| 33 | this.totalTexts = i; |
| 34 | return this; |
| 35 | }; |
| 36 | |
| 37 | public long getTotalTexts() { |
| 38 | return this.totalTexts; |
| 39 | }; |
| 40 | |
| 41 | public MatchCollector setTotalResults (int i) { |
| 42 | this.totalResults = i; |
| 43 | return this; |
| 44 | }; |
| 45 | |
| 46 | public MatchCollector incrTotalResults (int i) { |
| 47 | this.totalResults += i; |
| 48 | return this; |
| 49 | }; |
| 50 | |
| 51 | public int getTotalResults() { |
| 52 | return this.totalResults; |
| 53 | }; |
| 54 | |
| Nils Diewald | d723d81 | 2014-09-23 18:50:52 +0000 | [diff] [blame] | 55 | public void commit() {}; |
| Nils Diewald | ad3f303 | 2014-09-24 01:42:47 +0000 | [diff] [blame] | 56 | public void close() {}; |
| Nils Diewald | c7b6063 | 2014-09-05 19:59:01 +0000 | [diff] [blame] | 57 | |
| 58 | /* |
| 59 | * The following methods are shared and should be used from KorapResult |
| 60 | * And: |
| 61 | * getQueryHash |
| 62 | * getNode |
| 63 | */ |
| Nils Diewald | c7b6063 | 2014-09-05 19:59:01 +0000 | [diff] [blame] | 64 | }; |