Commit d5af27e9 authored by yanzg's avatar yanzg

修改实例化关系

parent 1d87feb8
...@@ -18,11 +18,11 @@ public class FormulaHelper { ...@@ -18,11 +18,11 @@ public class FormulaHelper {
private static final String REGEX_DOUBLE = "^[-+]?[0-9]*\\.?[0-9]+$"; private static final String REGEX_DOUBLE = "^[-+]?[0-9]*\\.?[0-9]+$";
private static final String REGEX_QUOT = "(^.*?)\\((.+?)\\)(.*?$)"; private static final String REGEX_QUOT = "(^.*?)\\((.+?)\\)(.*?$)";
private static final String REGEX_CALC_ADD_PLUS = "(^.*?)([+\\-])(.*?$)"; private static final String REGEX_CALC_ADD_PLUS = "(^.*)([+\\-])(.*?$)";
private static final String REGEX_CALC_MULTIPLY_MOD = "(^.*?)([*/])(.*?$)"; private static final String REGEX_CALC_MULTIPLY_MOD = "(^.*?)([*/])(.*?$)";
private static final String REGEX_CALC_TAG = "[+\\-*/()]+"; private static final String REGEX_CALC_TAG = "[+\\-*/()]+";
private static final String EMPTY_CHAR = " "; private static final String EMPTY_CHAR = " ";
public static String TEMP_VAR_NAME = "@temp"; private static final String TEMP_VAR_NAME = "@temp";
private static FormulaHelper calcInstance = new FormulaHelper(); private static FormulaHelper calcInstance = new FormulaHelper();
...@@ -49,7 +49,7 @@ public class FormulaHelper { ...@@ -49,7 +49,7 @@ public class FormulaHelper {
public static final int getExcelIndex(String columnName) { public static final int getExcelIndex(String columnName) {
columnName = columnName.toLowerCase(); columnName = columnName.toLowerCase();
if (!columnName.matches("^[a-z]+$")) { if (!columnName.matches("^[a-z]+$")) {
throw YzgError.getRuntimeException("013",columnName); throw YzgError.getRuntimeException("013", columnName);
} }
// 从名称转换列序号 // 从名称转换列序号
int formulaColumnIndex = 0; int formulaColumnIndex = 0;
......
...@@ -24,6 +24,13 @@ public class TestFormulaHelper { ...@@ -24,6 +24,13 @@ public class TestFormulaHelper {
})); }));
} }
@Test
public void testMul() {
// System.out.println(FormulaHelper.calc("(100-0)-2"));
System.out.println(FormulaHelper.calc("100-0-2"));
}
@Test @Test
public void test1() { public void test1() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment