@Test public void submitEvaluationTest() throws Exception { final String result = this.jepInstance.submitEvaluation((jep) -> jep.getValue("1 + 2")).get().toString(); assertThat(result) .as("The result of the evaluation") .isEqualTo("3"); }
public <T> AbstractJepEvaluation<T> submitEvaluation(final JepFunction<T> evaluationFunction) { if (!this.running) { throw new RuntimeException("Jep instance is not running."); } final AbstractJepEvaluation<T> evaluation = new AbstractJepEvaluation<T>() { @Override public T apply(final Jep jep) throws JepException { return evaluationFunction.apply(jep); } }; this.evaluationQueue.add(evaluation); return evaluation; }
JepInstance implements Runnable { public <T> AbstractJepEvaluation<T> submitEvaluation(final JepFunction<T> evaluationFunction) { if (!this.running) { throw new RuntimeException("Jep instance is not running."); } final AbstractJepEvaluation<T> evaluation = new AbstractJepEvaluation<T>() { @Override public T apply(final Jep jep) throws JepException { return evaluationFunction.apply(jep); } }; this.evaluationQueue.add(evaluation); return evaluation; } }
JepInstance implements Runnable { public <T> AbstractJepEvaluation<T> submitEvaluation(final JepFunction<T> evaluationFunction) { if (!this.running) { throw new RuntimeException("Jep instance is not running."); } final AbstractJepEvaluation<T> evaluation = new AbstractJepEvaluation<T>() { @Override public T apply(final Jep jep) throws JepException { return evaluationFunction.apply(jep); } }; this.evaluationQueue.add(evaluation); return evaluation; } JepInstance(); }
JepInstance implements Runnable { public <T> AbstractJepEvaluation<T> submitEvaluation(final JepFunction<T> evaluationFunction) { if (!this.running) { throw new RuntimeException("Jep instance is not running."); } final AbstractJepEvaluation<T> evaluation = new AbstractJepEvaluation<T>() { @Override public T apply(final Jep jep) throws JepException { return evaluationFunction.apply(jep); } }; this.evaluationQueue.add(evaluation); return evaluation; } JepInstance(); void start(); void stop(); @Override void run(); AbstractJepEvaluation<T> submitEvaluation(final JepFunction<T> evaluationFunction); }
JepInstance implements Runnable { public <T> AbstractJepEvaluation<T> submitEvaluation(final JepFunction<T> evaluationFunction) { if (!this.running) { throw new RuntimeException("Jep instance is not running."); } final AbstractJepEvaluation<T> evaluation = new AbstractJepEvaluation<T>() { @Override public T apply(final Jep jep) throws JepException { return evaluationFunction.apply(jep); } }; this.evaluationQueue.add(evaluation); return evaluation; } JepInstance(); void start(); void stop(); @Override void run(); AbstractJepEvaluation<T> submitEvaluation(final JepFunction<T> evaluationFunction);  }