1 between 0 and 4 的编译结果:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 package org.kie.dmn.feel.codegen.feel11.genadeb1f468481413bbc5bfd45c3422978;import static org.kie.dmn.feel.codegen.feel11.CompiledFEELSemanticMappings.*;import org.kie.dmn.feel.codegen.feel11.CompiledCustomFEELFunction;import org.kie.dmn.feel.codegen.feel11.CompiledFEELExpression;import org.kie.dmn.feel.codegen.feel11.CompiledFEELSupport;import org.kie.dmn.feel.lang.EvaluationContext;public class TemplateCompiledFEELExpression implements org .kie.dmn.feel.codegen.feel11.CompiledFEELExpression { @Override public Object apply (EvaluationContext feelExprCtx) { return between(feelExprCtx, K___1, K___0, K___4); } private static TemplateCompiledFEELExpression INSTANCE; public static TemplateCompiledFEELExpression getInstance () { if (INSTANCE == null ) { INSTANCE = new TemplateCompiledFEELExpression (); } return INSTANCE; } public static final java.math.BigDecimal K___1 = new java .math.BigDecimal(1 , java.math.MathContext.DECIMAL128); public static final java.math.BigDecimal K___0 = new java .math.BigDecimal(0 , java.math.MathContext.DECIMAL128); public static final java.math.BigDecimal K___4 = new java .math.BigDecimal(4 , java.math.MathContext.DECIMAL128); }
between调用的方法是org.kie.dmn.feel.codegen.feel11.CompiledFEELSemanticMappings.between方法,是预先写好的。 我觉得相比于ast的方式,把一些变量放在类里面了。编译完之后也可以直接加载使用。
The retrieved CompiledFEELExpression
could be a statically-interpreted InterpretedExecutableExpression
(that wraps the original BaseNode
ast ) or could be a dynamically-code-generated CompiledExecutableExpression
. In the first case, evaluation is executed by the DMN code as it is statically defined. In the latter case, code is generated out of the given model. In that code, some variable will be directly written in the generated, speeding up its execution.