aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/main/java/com/yahoo/document/select/rule/ExpressionNode.java
blob: 1c0b009396d319ae91c28f3e3d64fecfd7806c48 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.document.select.rule;

import com.yahoo.document.BucketIdFactory;
import com.yahoo.document.select.BucketSet;
import com.yahoo.document.select.Context;
import com.yahoo.document.select.Visitor;

/**
 * The interface of all expression nodes. It declares the methods requires by all expression nodes to maintain
 * a working document selector language.
 *
 * @author Simon Thoresen Hult
 */
public interface ExpressionNode {

    /**
     * Evaluate the content of this node based on document object, and return that value.
     *
     * @param doc the document to evaluate over
     * @return the value of this
     */
    Object evaluate(Context doc);

    /**
     * Returns the set of bucket ids covered by this node.
     *
     * @param factory the factory used by the current application
     */
    BucketSet getBucketSet(BucketIdFactory factory);

    /**
     * Perform visitation of this node.
     *
     * @param visitor the visitor that wishes to visit the node
     */
    void accept(Visitor visitor);

}