aboutsummaryrefslogtreecommitdiffstats
path: root/indexinglanguage/src/main/java/com/yahoo/vespa/indexinglanguage/expressions/CompositeExpression.java
blob: 8c00aad6bb04dfd7970d734535c96de2a24ba360 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.indexinglanguage.expressions;

import com.yahoo.document.DataType;
import com.yahoo.vespa.indexinglanguage.ExpressionConverter;

/**
 * @author Simon Thoresen Hult
 */
public abstract class CompositeExpression extends Expression {

    @Override
    public abstract CompositeExpression convertChildren(ExpressionConverter converter);

    protected CompositeExpression(DataType inputType) {
        super(inputType);
    }

    protected static String toScriptBlock(Expression exp) {
        if (exp instanceof ScriptExpression) {
            return exp.toString();
        }
        if (exp instanceof StatementExpression) {
            return new ScriptExpression((StatementExpression)exp).toString();
        }
        return new ScriptExpression(new StatementExpression(exp)).toString();
    }

}