aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/main/java/com/yahoo/searchlib/rankingexpression/transform/TransformContext.java
blob: 60a999b16336413335953dbdca09350a08faba75 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.searchlib.rankingexpression.transform;

import com.yahoo.searchlib.rankingexpression.Reference;
import com.yahoo.searchlib.rankingexpression.evaluation.Value;
import com.yahoo.tensor.evaluation.TypeContext;

import java.util.Map;

/**
 * Provides a context in which transforms on ranking expressions take place.
 *
 * @author bratseth
 */
public class TransformContext {

    private final Map<String, Value> constants;
    private final TypeContext<Reference> types;

    public TransformContext(Map<String, Value> constants, TypeContext<Reference> types) {
        this.constants = constants;
        this.types = types;
    }

    public Map<String, Value> constants() { return constants; }

    /**
     * Returns the types known in this context. We may have type information for references
     * for which no value is available
     */
    public TypeContext<Reference> types() { return types; }

}