aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/prelude/semantics/rule/LiteralCondition.java
blob: b85dd892047ef7d78cc316090de150c17f37dc8b (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.prelude.semantics.rule;

import com.yahoo.prelude.semantics.engine.RuleEvaluation;

/**
 * A condition which is always true, and which has its own value as return value
 *
 * @author bratseth
 */
public class LiteralCondition extends Condition {

    private String value;

    public LiteralCondition(String value) {
        this.value=value;
    }

    protected boolean doesMatch(RuleEvaluation e) {
        e.setValue(value);
        return true;
    }

    public void setValue(String value) { this.value=value; }

    public String getValue() { return value; }

    public String toInnerString() { return "'" + value + "'"; }

}