Пример #1
0
        internal DataExpression(DataTable table, string expression, Type type)
        {
            ExpressionParser parser = new ExpressionParser(table);
            parser.LoadExpression(expression);

            _originalExpression = expression;
            _expr = null;

            if (expression != null)
            {
                _storageType = DataStorage.GetStorageType(type);
                if (_storageType == StorageType.BigInteger)
                {
                    throw ExprException.UnsupportedDataType(type);
                }

                _dataType = type;
                _expr = parser.Parse();
                _parsed = true;
                if (_expr != null && table != null)
                {
                    Bind(table);
                }
                else
                {
                    _bound = false;
                }
            }
        }
 internal DataExpression(DataTable table, string expression, Type type)
 {
     this.dependency = DataTable.zeroColumns;
     ExpressionParser parser = new ExpressionParser(table);
     parser.LoadExpression(expression);
     this.originalExpression = expression;
     this.expr = null;
     if (expression != null)
     {
         this._storageType = DataStorage.GetStorageType(type);
         if (this._storageType == StorageType.BigInteger)
         {
             throw ExprException.UnsupportedDataType(type);
         }
         this._dataType = type;
         this.expr = parser.Parse();
         this.parsed = true;
         if ((this.expr != null) && (table != null))
         {
             this.Bind(table);
         }
         else
         {
             this.bound = false;
         }
     }
 }
Пример #3
0
        private double slope(double x0, double y0)
        {
            // Instantiate the parser
            ExpressionParser parser = new ExpressionParser();

            // Create a hashtable to hold values
            Hashtable h = new Hashtable();

            // Add variables and values to hashtable
            h.Add("x", x0.ToString());
            h.Add("y", x0.ToString());
            h.Add("t", y0.ToString());
            h.Add("c", 0);
            h.Add("c1", 0);
            h.Add("c2", 0);

            // Parse and write the result
            string tempFunction = grSettings.FunctionA;
            double result = parser.Parse(tempFunction, h);

            return result;
        }
Пример #4
0
        private double parametricfunction(string _function, double t0)
        {
            // Instantiate the parser
            ExpressionParser parser = new ExpressionParser();

            // Create a hashtable to hold values
            Hashtable h = new Hashtable();

            // Add variables and values to hashtable
            h.Add("t", t0.ToString());
            h.Add("x", 0);
            h.Add("c", 0);
            h.Add("c1", 0);
            h.Add("c2", 0);

            // Parse and write the result
            string tempFunction = _function;
            double result = parser.Parse(tempFunction, h);

            return result;
        }