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

net.intelie.pipes.util.ConstantHelper Maven / Gradle / Ivy

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

import net.intelie.pipes.Expression;
import net.intelie.pipes.Literal;
import net.intelie.pipes.types.Level;

public abstract class ConstantHelper {
    public static boolean isConstant(Object obj) {
        return Level.CONSTANT.accepts(obj);
    }

    public static  T evaluate(Expression obj) {
        return Level.asScalar(obj).eval(null, null);
    }

    public static  Literal simplify(Expression obj) {
        return new Literal<>(obj.type(), evaluate(obj));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy