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

jaskell.expression.Parameter Maven / Gradle / Ivy

Go to download

This is a utils library for java 8 project. It include parsec combinators and sql generators library.

There is a newer version: 2.9.2
Show newest version
package jaskell.expression;

import java.util.Optional;

/**
 * TODO
 *
 * @author mars
 * @version 1.0.0
 * @since 2020/06/10 18:03
 */
public class Parameter implements Expression {
  private final String name;

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

  @Override
  public double eval(Env env) throws ExpressionException {
    Optional value = env.get(name);
    if (value.isPresent()) {
      return value.get().eval(env);
    } else {
      throw new ExpressionException(name + " not found");
    }
  }

  @Override
  public Expression makeAst() {
    return this;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy