source: SRUClient/trunk/src/main/java/eu/clarin/sru/client/SRUScanResponse.java @ 7272

Last change on this file since 7272 was 7272, checked in by Oliver Schonefeld, 2 years ago
  • update copyright
  • Property svn:eol-style set to native
File size: 2.2 KB
Line 
1/**
2 * This software is copyright (c) 2012-2022 by
3 *  - Leibniz-Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
4 * This is free software. You can redistribute it
5 * and/or modify it under the terms described in
6 * the GNU General Public License v3 of which you
7 * should have received a copy. Otherwise you can download
8 * it from
9 *
10 *   http://www.gnu.org/licenses/gpl-3.0.txt
11 *
12 * @copyright Leibniz-Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
13 *
14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
15 *  GNU General Public License v3
16 */
17package eu.clarin.sru.client;
18
19import java.util.Collections;
20import java.util.List;
21
22
23
24/**
25 * A response to a <em>scan</em> request.
26 */
27public final class SRUScanResponse extends SRUAbstractResponse<SRUScanRequest> {
28    private final List<SRUTerm> terms;
29
30
31    SRUScanResponse(SRUScanRequest request,
32            List<SRUDiagnostic> diagnostics,
33            List<SRUExtraResponseData> extraResponseData,
34            int totalBytesTransferred,
35            long timeTotal,
36            long timeQueued,
37            long timeNetwork,
38            long timeProcessing,
39            List<SRUTerm> terms) {
40        super(request, diagnostics, extraResponseData, totalBytesTransferred,
41                timeTotal, timeQueued, timeNetwork, timeProcessing);
42        this.terms = ((terms != null) && !terms.isEmpty())
43                ? Collections.unmodifiableList(terms)
44                : null;
45    }
46
47
48    /**
49     * Get list of terms matched by the request.
50     *
51     * @return a list of terms or <code>null</code> if no terms matched the
52     *         request.
53     */
54    public List<SRUTerm> getTerms() {
55        return terms;
56    }
57
58
59    /**
60     * Check, if response contains any terms.
61     *
62     * @return <code>true</code> of response contains terms, <code>false</code>
63     *         otherwise
64     */
65    public boolean hasTerms() {
66        return terms != null;
67    }
68
69
70    /**
71     * Get the number of terms returned by the request.
72     *
73     * @return the number of terms or <code>0</code> if none
74     */
75    public int getTermsCount() {
76        return (terms != null) ? terms.size() : 0;
77    }
78
79} // class SRUScanResponse
Note: See TracBrowser for help on using the repository browser.