killme2008 / killme2008/aviatorscript
表达式或者变量复用
- Dominant language
- Java
- Stars
- 5.2k
- Forks
- 906
- PR merge metrics
- No merged PRs in 30d
Description
我现在使用aviator进行实现一个自定义的规则引擎,通过对一些逻辑表达式求值,得出最终结果。
现在有个问题是这些逻辑表达式中,有一部分是开放给用户可以编辑的,有一部分是不能编辑的。
例如现在有一个逻辑表达式:速度>0&&速度<50&&信号灯==绿灯
我需要将“速度>0&&速度<50”提取出来作为一个变量,让用户可以修改速度范围,在编译表达时将这部分提取出来的表达式替换进行编译。目前想到的办法是字符串替换,定义一个变量a值为“速度>0&&速度<50”,表达式变为#{a}&&信号灯==绿灯,在编译之前将#{a}替换为对应表达式。但是感觉这种方式不够优雅,有没有更优雅的实现办法。谢谢。
Contributor guide
No contributing guide indexed for this repository
Research direction
Issue #663 does not name any source files, tests, or compilation entry points. Start by locating Aviator's expression compilation and variable-handling APIs, then determine whether reusable expression fragments are supported without string replacement. Done would require an agreed API and tests covering editable and fixed parts of a combined expression.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100