コード例 #1
0
        public void AddTimeRecord(double time, Initiator init, Subprogram subp /*int lable*/, bool islast)
        {
            if (islast)
            {
                ID_event_Counter--;
            }
            RecordFTT NewRec = new RecordFTT(ID_event_Counter, time, init, subp);

            ID_event_Counter++;
            FTT.Add(NewRec);
        }
コード例 #2
0
 public RecordFTT FindNextMinTimeRecord()
 {
     if (this.TimesTable.Count > 0)
     {
         double    time   = this.TimesTable.Min(rec => rec.ActiveTime);
         RecordFTT result = this.TimesTable.Find(rec => rec.ActiveTime == time);
         return(result);
     }
     else
     {
         return(null);
     }
 }
コード例 #3
0
ファイル: QueueTable.cs プロジェクト: LatsynNiK/SLT-project
        public void Update(SLT.Initiator init)
        {
            foreach (Queue q in this.Queues)
            {
                q.Items.Clear();
            }

            foreach (RecordCT rec in ParentExecutor.TC_Cont.ConditionsTable)
            {
                this.ParentExecutor.SetInitiator(rec.Initiator);
                bool right_cond = this.ParentExecutor.ComputeLogicExpression(rec.Condition);
                if (right_cond)
                {
                    Queue que = this.Queues.Find(q => q.Place == rec.Subprogram);
                    que.Add(rec.Initiator, Queue.DelayType.Ready);
                }
            }

            FutureTimesTable FTT = new FutureTimesTable();

            FTT.TimesTable = ParentExecutor.TC_Cont.FutureTimesTable.ToList();

            while (FTT.TimesTable.Count > 0)
            {
                RecordFTT rec = FTT.FindNextMinTimeRecord();
                this.ParentExecutor.SetInitiator(rec.Initiator);
                Queue que = this.Queues.Find(q => q.Place == rec.Subprogram);
                que.Add(rec.Initiator, Queue.DelayType.WaitTime);
                FTT.TimesTable.Remove(rec);
            }

            foreach (RecordCT rec in ParentExecutor.TC_Cont.ConditionsTable)
            {
                this.ParentExecutor.SetInitiator(rec.Initiator);
                bool right_cond = this.ParentExecutor.ComputeLogicExpression(rec.Condition);
                if (right_cond == false)
                {
                    Queue que = this.Queues.Find(q => q.Place == rec.Subprogram);
                    que.Add(rec.Initiator, Queue.DelayType.Stopped);
                }
            }
            //для сохранения состояния
            this.ParentExecutor.SetInitiator(init);
        }
コード例 #4
0
        public RecordEvent FindNextEvent()
        {
            RecordEvent result;

            foreach (RecordCT rec_ct in this.CT.CondTable)
            {
                this.ParentExecutor.SetInitiator(rec_ct.Initiator);
                bool right_cond = this.ParentExecutor.ComputeLogicExpression(rec_ct.Condition);
                if (right_cond)
                {
                    result = rec_ct;
                    return(result);
                }
            }
            RecordFTT rec = this.FTT.FindNextMinTimeRecord();

            if (rec != null)
            {
                result = rec;
                return(result);
            }
            return(null); // модель остановлена
        }
コード例 #5
0
        public void Delete(int id_rec)
        {
            RecordFTT rec = this.TimesTable.Find(r => r.ID == id_rec);

            this.TimesTable.Remove(rec);
        }
コード例 #6
0
 public void Add(RecordFTT rec)
 {
     this.TimesTable.Add(rec);
 }