登录 注册
当前位置:主页 > 资源下载 > 34 > 计算逆波兰式的引擎

计算逆波兰式的引擎

  • 更新:2024-10-04 23:09:44
  • 大小:5KB
  • 推荐:★★★★★
  • 来源:网友上传分享
  • 类别:Java - 后端
  • 格式:RAR

资源介绍

逆波兰式表达式计算引擎 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));