| margaretha | 9ebbb25 | 2017-11-23 16:40:08 +0100 | [diff] [blame] | 1 | package de.ids_mannheim.korap.sru; |
| margaretha | 3925c7a | 2016-02-24 11:20:49 +0000 | [diff] [blame] | 2 | |
| 3 | import java.util.ArrayList; |
| 4 | import java.util.List; |
| 5 | |
| 6 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| Eliza Margaretha | e07c421 | 2016-11-22 13:57:22 +0100 | [diff] [blame] | 7 | import com.fasterxml.jackson.annotation.JsonProperty; |
| margaretha | 3925c7a | 2016-02-24 11:20:49 +0000 | [diff] [blame] | 8 | |
| 9 | @JsonIgnoreProperties(ignoreUnknown = true) |
| 10 | public class KorapResult { |
| Eliza Margaretha | e07c421 | 2016-11-22 13:57:22 +0100 | [diff] [blame] | 11 | private List<KorapMatch> matches; |
| 12 | private List<List<Object>> errors; |
| 13 | private KorapMeta metadata; |
| 14 | |
| 15 | public KorapResult () { |
| 16 | matches = new ArrayList<KorapMatch>(); |
| 17 | } |
| 18 | |
| 19 | public int getTotalResults () { |
| 20 | return metadata.getTotalResults(); |
| 21 | } |
| 22 | |
| 23 | public List<List<Object>> getErrors () { |
| margaretha | 43ea731 | 2016-08-08 19:00:23 +0200 | [diff] [blame] | 24 | return errors; |
| 25 | } |
| 26 | |
| Eliza Margaretha | e07c421 | 2016-11-22 13:57:22 +0100 | [diff] [blame] | 27 | public void setErrors (List<List<Object>> errors) { |
| margaretha | 43ea731 | 2016-08-08 19:00:23 +0200 | [diff] [blame] | 28 | this.errors = errors; |
| 29 | } |
| 30 | |
| Eliza Margaretha | e07c421 | 2016-11-22 13:57:22 +0100 | [diff] [blame] | 31 | public List<KorapMatch> getMatches () { |
| margaretha | 43ea731 | 2016-08-08 19:00:23 +0200 | [diff] [blame] | 32 | return matches; |
| 33 | } |
| Eliza Margaretha | e07c421 | 2016-11-22 13:57:22 +0100 | [diff] [blame] | 34 | |
| 35 | public void setMatches (List<KorapMatch> matches) { |
| 36 | this.matches = matches; |
| 37 | } |
| 38 | |
| 39 | public KorapMatch getMatch (int i) { |
| 40 | if (i >= 0 && i < getMatchSize()) |
| 41 | return matches.get(i); |
| 42 | |
| 43 | return null; |
| 44 | } |
| 45 | |
| 46 | public int getMatchSize () { |
| 47 | return matches.size(); |
| 48 | } |
| 49 | |
| 50 | @JsonProperty("meta") |
| 51 | public KorapMeta getMetadata () { |
| 52 | return metadata; |
| 53 | } |
| 54 | |
| 55 | public void setMetadata (KorapMeta metadata) { |
| 56 | this.metadata = metadata; |
| 57 | } |
| margaretha | 3925c7a | 2016-02-24 11:20:49 +0000 | [diff] [blame] | 58 | } |