Project

General

Profile

Download (1.09 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2019 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.taxeditor.view.search.facet;
10

    
11
import java.util.HashSet;
12
import java.util.Set;
13

    
14
/**
15
 * @author pplitzner
16
 * @since Jan 23, 2019
17
 *
18
 * @param <T> The type of the search result
19
 */
20
public abstract class SearchResult<T> {
21

    
22
    private Set<Facet> facets = new HashSet<>();
23
    private T content;
24

    
25
    public SearchResult(T content) {
26
        super();
27
        this.content = content;
28
        facets = initFacets(content);
29
    }
30

    
31
    protected abstract Set<Facet> initFacets(T content);
32

    
33
    public boolean hasFacet(Facet facet){
34
        return facets.contains(facet);
35
    }
36

    
37
    public boolean hasAnyFacet(Set<Facet> facets){
38
        return facets.stream().anyMatch(facet->this.facets.contains(facet));
39
    }
40

    
41
    public T getContent() {
42
        return content;
43
    }
44

    
45
    public Set<Facet> getFacets() {
46
        return facets;
47
    }
48

    
49
}
(5-5/5)