Esempio n. 1
0
        //Object CurrentObject;

        public ObjectController(SLT.Model model)
        {
            //this.ID_Object_Counter = 0;
            //this.Initiator_Number_Counter = 0;
            this.ParentModel = model;
            this.Memory      = new Memory();
            this.IT          = new InitiatorsTable();
            this.GVT         = new GlobalVarsTable();
        }
Esempio n. 2
0
        //public void ClearOutput()
        //{
        //    this.Output = new OutputData(this.Precision);
        //}


        #region Rewrite
        void Rewrite_Objects()
        {
            GlobalVarsTable GVT = this.Model.O_Cont.GVT;

            this.Output.Objects.Rows.Clear();
            foreach (string unit in GVT.Vars.Keys.ToArray())
            {
                foreach (SLT.Object obj in GVT.Vars[unit])
                {
                    if (unit == obj.Unit)
                    {
                        string name      = obj.Name;
                        object value_obj = obj.GetValue();
                        try
                        {
                            value_obj = Convert.ToDouble(value_obj);
                            value_obj = Math.Round((double)value_obj, this.Precision);
                        }
                        catch { }
                        string value = Convert.ToString(value_obj);
                        string type  = "";
                        switch (obj.Type)
                        {
                        case SLT.ObjectType.Scalar:
                            type = "Скаляр";
                            break;

                        case SLT.ObjectType.Link:
                            type = "Ссылка";
                            break;

                        case SLT.ObjectType.Vector:
                            type = "Вектор";
                            break;

                        case SLT.ObjectType.Macro:
                            type = "Макрос";
                            break;
                        }

                        if (obj.Type == SLT.ObjectType.Vector)
                        {
                            value = ((SLT.Vector)obj).GetTree();
                        }
                        this.Output.Objects.Rows.Add(obj.Unit, obj.Name, value, type);
                        if (obj.Type == SLT.ObjectType.Vector)
                        {
                            SLT.Vector        Vec          = (SLT.Vector)obj;
                            SLT.Vector        SubVector    = (SLT.Vector)Vec;
                            List <SLT.Object> vector_value = (List <SLT.Object>)(SubVector.GetValue());
                            this.Write_Vector_to_DataTable(this.Output.Objects, vector_value);
                        }
                    }
                }
            }
        }