资源介绍
逆波兰式表达式计算引擎
ReversePolishExpression Tool V1.0.1 Feature
1.Attention! the input expression isn't allowed to constants Invalid Characters like '_、#'
2.It's supported the calculation of div(/) mod(%) sqrt(_) mul(*) sub(-) pow(^)
3.The Usage:
there is needly two HashMap .One as the input paramters and another was put into the
first HashMap for passing the expression's values.The parent HashMap contains lots of placeholders,
just like the 'AA'、'BB'、'CC' see the example code below.
eg.
HashMap maps = new HashMap();
HashMap kvmap = new HashMap();
maps.put("expression", "(((AA*-BB)*CC+(AA*-BB)/CC)+((AA*(-BB))*CC+(AA*-BB)%CC))");
kvmap.put("AA", 4);
kvmap.put("BB", 2);
kvmap.put("CC", 9);
maps.put("kvmap", kvmap);
System.out.println("使用工具结果:"+ReversePolishExpression.calculateExpression(maps));