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

com.tinkerpop.gremlin.groovy.engine.function.GSPredicate Maven / Gradle / Ivy

package com.tinkerpop.gremlin.groovy.engine.function;

import com.tinkerpop.gremlin.util.function.SPredicate;

import javax.script.ScriptException;

/**
 * @author Marko A. Rodriguez (http://markorodriguez.com)
 */
public class GSPredicate extends GLambda implements SPredicate {

    public GSPredicate(final String gremlinGroovyScript) {
        super(gremlinGroovyScript);
    }

    public boolean test(final A a) {
        try {
            return (boolean) engine.eval(this.gremlinGroovyScript, makeBindings(a));
        } catch (final ScriptException e) {
            throw new IllegalStateException(e.getMessage(), e);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy