summaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/query/profile/AllReferencesQueryProfileVisitor.java
blob: 759e3978b7b38457058e8f142c28f5a1b8972e2a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.query.profile;

import com.yahoo.processing.request.CompoundName;
import com.yahoo.search.query.profile.types.FieldDescription;
import com.yahoo.search.query.profile.types.QueryProfileFieldType;
import com.yahoo.search.query.profile.types.QueryProfileType;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
 * @author bratseth
 */
final class AllReferencesQueryProfileVisitor extends PrefixQueryProfileVisitor {

    /** A map of query profile types */
    private Set<CompoundName> references = new HashSet<>();

    public AllReferencesQueryProfileVisitor(CompoundName prefix) {
        super(prefix);
    }

    @Override
    public void onValue(String name, Object value, DimensionBinding binding, QueryProfile owner) {}

    @Override
    public void onQueryProfileInsidePrefix(QueryProfile profile, DimensionBinding binding, QueryProfile owner) {
        references.add(currentPrefix);
    }

    /** Returns the values resulting from this visiting */
    public Set<CompoundName> getResult() { return references; }

    /** Returns false - we are not done until we have seen all */
    public boolean isDone() { return false; }

}