aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/main/java/com/yahoo/searchlib/expression/CatFunctionNode.java
blob: ebde9b512a1c6956fb90a1db9eac156dec5063a6 (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
41
42
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.searchlib.expression;

/**
 * This function is an instruction to concatenate the bits of all arguments in order.
 *
 * @author baldersheim
 * @author Simon Thoresen Hult
 */
public class CatFunctionNode extends MultiArgFunctionNode {

    public static final int classId = registerClass(0x4000 + 72, CatFunctionNode.class);

    @Override
    protected int onGetClassId() {
        return classId;
    }

    @Override
    protected boolean equalsMultiArgFunction(MultiArgFunctionNode obj) {
        return true;
    }

    @Override
    protected void onPrepareResult() {
        setResult(new RawResultNode());
    }

    @Override
    protected void onPrepare() {
        super.onPrepare();
    }

    @Override
    protected boolean onExecute() {
        for (int i = 0; i < getNumArgs(); i++) {
            getArg(i).execute();
            ((RawResultNode)getResult()).add(getArg(i).getResult());
        }
        return true;
    }
}