当前位置: 首页 > 工具软件 > IKExpression > 使用案例 >

IKExpression

邰昀
2023-12-01

import java.util.ArrayList;
import java.util.List;

import org.wltea.expression.ExpressionEvaluator;
import org.wltea.expression.datameta.BaseDataMeta.DataType;
import org.wltea.expression.datameta.Variable;

public class IKExpressionTest {
public static void main(String[] args) {
/*String expression = "\"AGE\" + age1 + (age2 / age3)";

List<Variable> variables = new ArrayList<Variable>();
Variable variable = new Variable("age1", DataType.DATATYPE_DOUBLE, 3);
Variable variable2 = new Variable("age2", DataType.DATATYPE_DOUBLE, 4);
Variable variable3 = new Variable("age3", DataType.DATATYPE_DOUBLE, 5);
variables.add(variable);
variables.add(variable2);
variables.add(variable3);


Object result = ExpressionEvaluator.evaluate(expression,variables);
System.out.println(result);

String expression2 = "1.0 +23-4";
Object result2 = ExpressionEvaluator.evaluate(expression2);
System.out.println(result2);
*/
String expression = "item_13==3 || item_13==4";

List<Variable> variables = new ArrayList<Variable>();
Variable variable = new Variable("item_13", DataType.DATATYPE_INT, 3);
variables.add(variable);

Object result = ExpressionEvaluator.evaluate(expression,variables);
System.out.println(result);
}
}

 类似资料:

相关阅读

相关文章

相关问答