|
@@ -21,7 +21,7 @@ public class MinusNode extends OperatorResultNode {
|
|
|
Object rightValue = rightOperand.calculate(variables);
|
|
|
String leftStr=StringUtils.handleNull(leftValue);
|
|
|
String rightStr=StringUtils.handleNull(rightValue);
|
|
|
- if (leftStr.matches(DXD_REG) && rightStr.matches(DXD_REG)) {
|
|
|
+ if (leftStr.matches(DXD_REG) && rightStr.matches(DXD_REG)||rightStr.matches(DES_REG)) {
|
|
|
return CustomFunction.dXd(rightValue, leftValue);
|
|
|
}else if(leftStr.contains(COLON)&&rightStr.contains(COLON)){
|
|
|
return fraction(leftStr)-fraction(rightStr);
|
|
@@ -52,29 +52,20 @@ public class MinusNode extends OperatorResultNode {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
/* public static void main(String[] args) {
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
map.put("A","1:2.36");
|
|
|
map.put("B","1:4");
|
|
|
+ map.put("C","536");
|
|
|
+ map.put("C2","503");
|
|
|
+ map.put("D","540/500");
|
|
|
System.out.println(Expression.parse("A-B").calculate(map).toString());
|
|
|
+ System.out.println(Expression.parse("D-C").calculate(map).toString());
|
|
|
+ System.out.println(Expression.parse("C-D").calculate(map).toString());
|
|
|
+ System.out.println(Expression.parse("C2-D").calculate(map).toString());
|
|
|
}*/
|
|
|
|
|
|
-// public Object calculateOld(Map<String, Object> variables) {
|
|
|
-// Object leftValue = leftOperand.calculate(variables);
|
|
|
-// if(leftValue instanceof String && StringUtils.isNumber(leftValue)) {
|
|
|
-// leftValue = new BigDecimal(leftValue.toString());
|
|
|
-// }
|
|
|
-// if (!(leftValue instanceof Number)) {
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-// Object rightValue = rightOperand.calculate(variables);
|
|
|
-// if(rightValue instanceof String && StringUtils.isNumber(rightValue)) {
|
|
|
-// rightValue = new BigDecimal(rightValue.toString());
|
|
|
-// }
|
|
|
-// if (!(rightValue instanceof Number)) {
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-// return SubtractUtil.calculate((Number) leftValue, (Number) rightValue);
|
|
|
-// }
|
|
|
+
|
|
|
|
|
|
}
|