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

Last change on this file since 5750 was 5750, checked in by Oliver Schonefeld, 10 years ago
  • update copyright
  • clean-up whitespace
  • Property svn:eol-style set to native
File size: 1.9 KB
Line 
1/**
2 * This software is copyright (c) 2012-2014 by
3 *  - 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 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
22import org.w3c.dom.DocumentFragment;
23
24
25
26/**
27 * A response to a <em>scan</em> request.
28 */
29public final class SRUScanResponse extends SRUAbstractResponse<SRUScanRequest> {
30    private final List<SRUTerm> terms;
31
32
33    SRUScanResponse(SRUScanRequest request,
34            List<SRUDiagnostic> diagnostics,
35            DocumentFragment extraResponseData,
36            int totalBytesTransferred,
37            long timeTotal,
38            long timeQueued,
39            long timeNetwork,
40            long timeProcessing,
41            List<SRUTerm> terms) {
42        super(request, diagnostics, extraResponseData, totalBytesTransferred,
43                timeTotal, timeQueued, timeNetwork, timeProcessing);
44        this.terms = ((terms != null) && !terms.isEmpty())
45                ? Collections.unmodifiableList(terms)
46                : null;
47    }
48
49
50    /**
51     * Get list of terms matched by the request.
52     *
53     * @return a list of terms or <code>null</code> if no terms matched the
54     *         request.
55     */
56    public List<SRUTerm> getTerms() {
57        return terms;
58    }
59
60
61    /**
62     * Check, if response contains any terms.
63     *
64     * @return <code>true</code> of response contains terms, <code>false</code>
65     *         otherwise
66     */
67    public boolean hasTerms() {
68        return terms != null;
69    }
70
71} // class SRUScanResponse
Note: See TracBrowser for help on using the repository browser.