针对目前逻辑表达式求值算法中运算符的名称、优先级和运算规则都以硬编码的形式固化在算法中所带来的算法无法扩展的问题,通过将运算符的名称、优先级和运算规则抽象为接口的方法,设计并实现了一种新的逻辑表达式求值系统。该系统既保证了表达式求值算法的独立性,又允许用户自定义运算符和更新原有运算符运算规则,从而实现了逻辑表达式求值的可扩展性。
Aiming at the problem that operator's name, priority, and operation rule are hard-coded in the expression evaluation algorithm, which causes the algorithm can't be expanded, a novel method is proposed, which makes operator's name, priority and operation rule as a interface, and a novel expression evaluation is designed and implemented, which the independence of ex pression evaluation algorithm is supported, and user can customize operator and update the operation rule of the original opera tor, and thus the expansibility of logical expression evaluation is achieved.