Commit c435aa7a authored by yanzg's avatar yanzg

打印模板处理

parent 2a87ba80
...@@ -3,25 +3,24 @@ package helper; ...@@ -3,25 +3,24 @@ package helper;
import com.yanzuoguang.util.helper.CalcHelper; import com.yanzuoguang.util.helper.CalcHelper;
import org.junit.Test; import org.junit.Test;
public class TestCalcHelper implements CalcHelper.CalcParameter { public class TestCalcHelper {
@Test @Test
public void test() { public void test() {
System.out.println(CalcHelper.calc("2 * ( a + b * d )",this)); System.out.println(CalcHelper.calc("2 * ( a + b * d )", new CalcHelper.CalcParameter() {
} @Override
public double getValue(String parameterName) {
@Override switch (parameterName){
public double getValue(String parameterName) { case "a":
System.out.println("参数名:" +parameterName); return 5;
switch (parameterName){ case "b":
case "a": return 3;
return 5; case "d":
case "b": return 11;
return 3; default:
case "d": return 0;
return 11; }
default: }
return 0; }));
}
} }
} }
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