Esempio n. 1
0
        protected MMC.Numbers.CNumber.CNumberType _NumberType; // the type of numbers to create

        //------------------------------------------------------------
        // standard constructor
        public CEnvironment(MMC.Numbers.CNumber.CNumberType NumberType)
        {
            //--------------------------------------------------------
            // set up the type of numbers to generate
            _NumberType = NumberType;

            //--------------------------------------------------------
            // initialize the last result with 0
            _Result = new MMC.Calc.Functions.CTerm_Const("RES", NewNumber(0.0));

            //--------------------------------------------------------
            // Add the functions
            _Operations = new COperations();
            _Operations.Set(new MMC.Calc.Functions.CTerm_AND("AND"));
            _Operations.Set(new MMC.Calc.Functions.CTerm_OR("OR"));
            _Operations.Set(new MMC.Calc.Functions.CTerm_XOR("XOR"));
            _Operations.Set(new MMC.Calc.Functions.CTerm_NOT("NOT"));
            _Operations.Set(new MMC.Calc.Functions.CTerm_Add("+"));
            _Operations.Set(new MMC.Calc.Functions.CTerm_Sub("-"));
            _Operations.Set(new MMC.Calc.Functions.CTerm_Mul("*"));
            _Operations.Set(new MMC.Calc.Functions.CTerm_Div("/"));
            _Operations.Set(new MMC.Calc.Functions.CTerm_Mod("%"));
            _Operations.Set(new MMC.Calc.Functions.CTerm_Power("^"));
            _Operations.Set(new MMC.Calc.Functions.CTerm_Square("sqr"));
            _Operations.Set(new MMC.Calc.Functions.CTerm_SquareRoot("sqrt"));
            _Operations.Set(new MMC.Calc.Functions.CTerm_Sinus("sin"));
            _Operations.Set(new MMC.Calc.Functions.CTerm_SinusHyperbolicus("sinh"));
            _Operations.Set(new MMC.Calc.Functions.CTerm_Cosinus("cos"));
            _Operations.Set(new MMC.Calc.Functions.CTerm_CosinusHyperbolicus("cosh"));
            _Operations.Set(new MMC.Calc.Functions.CTerm_Tangens("tan"));
            _Operations.Set(new MMC.Calc.Functions.CTerm_TangensHyperbolicus("tanh"));
            _Operations.Set(new MMC.Calc.Functions.CTerm_Radiant("rad"));
            _Operations.Set(new MMC.Calc.Functions.CTerm_Degree("deg"));
            _Operations.Set(new MMC.Calc.Functions.CTerm_Diagonale("diag"));
            _Operations.Set(new MMC.Calc.Functions.CTerm_Date("date"));
            _Operations.Set(new MMC.Calc.Functions.CTerm_Day("day"));

            //--------------------------------------------------------
            // add the initial constants
            _Constants = new COperations();
            _Constants.Set(new MMC.Calc.Functions.CTerm_Const("pi", NewNumber(Math.PI)));
            _Constants.Set(new MMC.Calc.Functions.CTerm_Const("e", NewNumber(Math.E)));
            _Constants.Set(_Result);

            //--------------------------------------------------------
            // add the supporting cast
            _Support = new COperations();
            _Support.Set(new MMC.Calc.Functions.CTerm_Bracket("("));
            _Support.Set(new MMC.Calc.Functions.CTerm_BracketClose(")"));
            //_Support.Set(new MMC.Calc.Functions.CTerm_Separator(",")); // possible decimal separator!
            _Support.Set(new MMC.Calc.Functions.CTerm_Separator(";"));
            _Support.Set(new MMC.Calc.Functions.CTerm_Assignment("="));

            //--------------------------------------------------------
            // create the table for the user defined variables
            _Variables = new COperations();
        }
Esempio n. 2
0
 //------------------------------------------------------------
 // add a new or replace a function/variable
 public void SetVariable(MMC.Calc.CTerm_Base Term)
 {
     _Variables.Set(Term);
 }