All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.intelie.pipes.AstFunction Maven / Gradle / Ivy

There is a newer version: 0.25.5
Show newest version
package net.intelie.pipes;

import net.intelie.pipes.ast.AstNode;

public abstract class AstFunction implements Function {
    private static final long serialVersionUID = 1L;
    private final String name;

    public AstFunction(String name) {
        this.name = name;
    }

    public abstract AstNode getNode(ArgQueue queue);

    @Override
    public Object declare(ArgQueue queue) throws PipeException {
        return queue.context().compile(getNode(queue)).result();
    }

    @Override
    public String description() {
        return name;
    }

    @Override
    public String name() {
        return name;
    }

    @Override
    public HelpData help() {
        return null;
    }

    public static class Constant extends AstFunction {
        private final AstNode node;

        public Constant(String name, AstNode node) {
            super(name);
            this.node = node;
        }

        @Override
        public AstNode getNode(ArgQueue queue) {
            return node;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy