Пример #1
0
        public double compute(string s, AbstractScan scan)
        {
            //记法扫描类
//			Scan scan=new Scan();

            if (s.Trim().Length == 0)
            {
                throw new Exception("表达式为空");
            }
            list = scan.parse(s);

            createSuffixExpression();
            return(reckon());
        }
Пример #2
0
        /// <summary>
        /// 产生扫描器
        /// </summary>
        /// <param name="usePrefix"></param>
        /// <returns></returns>
        public static AbstractScan createScan(bool usePrefix)
        {
            AbstractScan scan = null;

            if (!usePrefix)
            {
                scan = new StrictScan();
            }
            else
            {
                scan = new RelaxedScan();
            }

            return(scan);
        }
Пример #3
0
 /// <summary>
 /// 引用其它仪器的数据默认方式,不使用!前缀
 /// </summary>
 public CalcFunction()
 {
     scan = ScanFactory.createScan(false);
 }
Пример #4
0
 /// <summary>
 /// 是否使用表达式前缀,usePrefix为true,引用其它二级变量前面要加上! 如!kk23.e4 或!kk-kk.e4
 /// </summary>
 /// <param name="usePrefix"></param>
 public CalcFunction(bool usePrefix)
 {
     scan = ScanFactory.createScan(usePrefix);
 }